Sign in to follow this  

Please have a look at my UML diagram (pic incl.)

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently made a little snake game, but i didn't spend much time on the design of the classes. So this time I want to make Snake again, but then with nice classes and all... I've made a diagram in Microsoft Visio, please have a look at it and tell me what i can improve... By the way, I'm really new to UML, so i probably made some huge mistakes :-) Here's the diagram: And here is the diagram in visio format: Clicky What i've basicly done is seperating game logic from engine logic. Please note that the diagram isn't finished yet, but i want to know if I'm on the right track.

Share this post


Link to post
Share on other sites
Yeah, the diagram looks good.

It's a neat tool (or so I've been told) for large scale software design on long lasting projects with multiple programmers.
However I suspect that UML will get in your way for such a small project.
What I'm trying to say is that, despite of what they might try to teach you in school, designing everything in UML is not a sign of being a "pro" developer but rather the other way around.

There's no shame in hacking ;)

Share this post


Link to post
Share on other sites
Whether on paper or in some program (like Visio), drawing diagrams of your programs can help you keep things organized. I've been working on a project that has about 5 different "sections" right now and it's much easier to just look at a diagram to see how things interact and how you can improve the design.

Even for small projects it can be important. That diagram may be a bit complex but as long as it helps you understand the program flow and how different parts of your project interact then it's a good thing™.

Share this post


Link to post
Share on other sites
UML is nice, but part of good UML is knowing the right level of detail to use. For example, I think having CException on your diagram is just too detailed and is making it harder to understand since there are lots of relation edges going to it. Once you have say, 10 exceptions, it would be nice to see a separate diagram showing how all your exceptions inherit from each other, but I wouldn't want to see this exception class tree with the rest of your 20 game classes with edges coming from every single class that uses each of the exceptions. It will get messy quickly and doesn't help you understand what is going on.



You might want to try adding labels to your relation edges too, such as "gets player input with" on the edge from CApplication to IInputDevices. It might help to put some of your classes in package boxes too, such as having CMouse, CKeyboard and IInputDevices with a box around it and the same for your game classes to cleanly seperate the functionality on the diagram. Otherwise, you don't really know where to look on your diagram because you cannot tell how relevent each class is compared to the rest as it's hard to see what it contributes without reading all the classes and following all the edges.



It's looking good though; it's nice to see people concerned with communicating their designs. :)

Share this post


Link to post
Share on other sites
As has been said, I think that going to the detail of showing relationships with common utility classes (eg. CException) is a bit overkill and will only make the diagrams more confusing. Apart from that, looks good!

Share this post


Link to post
Share on other sites
Thank you all for your replies.

This diagram may indeed seem overkill for this little project, but I'm figuring out how to design my code base so i can use the same engine in other games.

I used to hack away my programs, but i always tend to code myself in a corner, focussing to much on the small details.

Like I've said, I've already made a snake game. But the code is horrible to maintain! Some friends gave me suggestions to add some extra functionality, like bonusses, network play, etc.

I really think it's important to think about your designs, before you implement them. Even if it seems insignificant at first, you'll soon realize that it's quite essential.

seanw and joanusdmentia you're both right about the CException class. The whole engine relies on that class, as well as the CLog class. The idea to make another diagram sounds good.

I also like the idea to put them in packages. I tried to do that already, but Visio won't let me put the classes in Packages :-S, must be doing something wrong here.

Thanks again for your input

Share this post


Link to post
Share on other sites

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this