✅ Question regarding C# UML diagrams and classes
Hello! Do classes need to have some form of relation in a UML diagram? I'm making Go Fish in VSC, have two classes made, one for the player and one for the deck. While both classes are used in the project's main file, neither class is referenced inside of the other. This leads me to ask if they can be separate on a UML diagram or if it means I need to make a 'game' class to put my main file's process in, while relating the Player and Deck class to it in the diagram. Hope this makes sense, still very new to this. Thanks!
15 Replies
what do you mean by relation?
consumption/inheritance?
Yes, like OOP relations
A dog Is An animal
however the dog does not need to hold a rocket launcher
unless that's what your game is about but generally
you dont need to over complicate things if you dont need to
I think I understand. So I probably don't need to make a class for the game process as a whole then?
what do you mean by that?
like a state machine?
I'm not sure what a state machine is. When I look online or at my teacher's example version of another project, there seems to be a class that holds the majority of code, then an instance is made of this 'game' class in the main program.cs file
does it look something like this?
More like this I think (found on google). If I'm right here, the box with "GoFish" is the class that acts as the game's process. it can inherit the other classes but they can't inherit it
So what I'm wondering is if I need to make that or if the classes can just have no relation to anything and be floating
Or if I need to make that and make the same in my code instead of just referencing things from both classes in the program.cs
well technically program.cs would be the class that acts as the game's process (assuming your game is a console app)
there is no god class like that, you would have to create the game loop that does what you want to manipulate the objects in your games
Ah, yes. I just mean where all program.cs has is something like
(example from a diff project)
Ah alright
Thank you for the help
I condtradict with IceGPT and I think its a very good idea to encapsulate the game in its own type. Program.cs can be seen as a client that only calls what we have. It should stay stupid IMO and not contain thhe logic
this is also how we have it in Asp.Net Core for example. Program.cs doesn't contain the code to create and run the webapplication, it only calls it.
Yeah, I read up on it a little more and I agree. Thank you as well!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.