UML plugin for visual studio (2010)?

Started by
10 comments, last by frob 9 years, 3 months ago

Hi folks,

Since I've been using VS 2010, I tried to generate a class diagram a lot of times.

But unfortunately without any luck so far..

Somehow in all my projects I end up with this error:

"An item with the same key has already been added'", and no class diagram as a result unsure.png

What I've noticed that in the class view in VS I also see my classes sometimes multiple times, my suspicion is that this is related to forward declarations and things like that. Here's an example:

classview.jpg

I also tried generating dependency diagrams from within VS, using the Architecture menu and it's options.

In the end, non succesful.

Now my question(s):

- can I generate a nice class diagram with VS and somehow get rid of the error message above?

(without stopping to use forward declarations)

- are there any nice UML 'plugins' for VS 2010 which you have good experience with?

Any input is appreciated.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Advertisement
A game development forum might be the world's worst place to ask about UML tools. tongue.png

Sean Middleditch – Game Systems Engineer – Join my team!

The usability of tools is very much hit-and-miss.

About 15 years ago there was a big push by a few communities to have UML tools for everything including code generation. That idea failed terribly. Some people still have a horrible reaction because of that. Old habits die hard and hating is a common hobby on the Internet.

UML is a great tool for communication and visualization. Tools that generate class diagrams and inheritance hierarchies and the like can be very nice.

If your current set of plugins don't work, you might consider Doxygen and DoxyGraph. Make sure you have graphviz installed and then run doxygen with the visualization options turned on. You can get it configured to generate class diagrams, call graphs, caller graphs, included by graphs, and the rest. It can also generate intermediate output used as input to various other tools.

In a fun twist, don't let UML-haters know that not just Visual Studio, but also Doxygen, Eclipse, Jira/Confluence, Dia, and various other in-favor tools can all generate and work with UML's class diagrams, object diagrams, communication diagrams, component diagrams, communication diagrams, and potentially other UML diagrams that are all useful in understanding and communicating about software. Such knowledge can make UML-haters and trolls get really angry when cognitive dissonance kicks in. Tools can go C++ --> Doxygen --> PlantUML --> Confluence --> UML visualization of massive source trees.

Thanks. I didn't know about the cloud that hangs above UML in game dev.
In my opinion it's a good tool when used for the right purposes (and not as a goal itself). For example to see if you don't accidentally have classes with more then 1 purpose or situations where inheritance can be used better etc.

Just out of curiosity, what alternative method won the battle against UML in gamedev?

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Isn't it that the dislike is more about too much time wasted on planning the diagrams which get outdated soon, and not about using UML in the diagrams?

I would think generating code from UML is wasted effort, but generating diagrams from code could be helpful for people new to the codebase?

OK, that sounds more like a dislike to doing things that are not useful in general :)

If you have the discipline + any tool, you can get enough value from making diagrams where needed.

Especially where you generate a diagram from your code, you can simply run it periodic and have actual diagrams showing (flaws in) relations etc.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Thanks. I didn't know about the cloud that hangs above UML in game dev.


It varies. The people in the game industry that I've personally interacted with ranged from ambivalent to hostile towards UML, though those certainly aren't the entirety of all people in the industry. smile.png I personally am fine with it so long as I don't have to maintain it, which is where the tools come in, though any project that needs it to be comprehensible would not be one I'd want to work on (and I work on multi-million-line codebases daily).

Most people just think of UML as nothing but class diagrams, and the need for those mostly arise in very poorly structured code; the kind that languages like Java all but force you to write but which you shouldn't ever be writing in C++, especially not in a game. The class diagram for well-written C++ classes wouldn't actually say anything all that useful, since there'd be few public methods and few (if any) public bases or derived classes. Unfortunately, "shouldn't ever write in a game" does not equate to "no game does that," so there certainly are game and engine codebases that have a very Java-like code structure to them that need a lot of visualization assistance to make sense of.

UML sequence diagrams, state charts, and so on can all be quite useful when documenting stable code. Gameplay code is very rarely ever all that stable, but core engine and gameplay support systems code can be benefit from it on mature products, not to mention network/Web service backends.

Sean Middleditch – Game Systems Engineer – Join my team!

Yes, I agree that also in my case my engine code base class diagram would not say much. Honestly I also thought it would be fun to figure out what it would tell me. Through the years the codebase of my engine grew that much that I had to structure it anyway, without generating diagrams (just using pen and paper).

I recently started my 1st game using my own engine, and definately I can confirm that the game code isn't getting 'cleaner'/ stabler when adding game features. I also found out that it can be a good thing to let "overkill structuring" a bit go when you start with (adding) game code after my engine was 80/20 ready to use for a game.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me


Just out of curiosity, what alternative method won the battle against UML in gamedev?

Have a read of this thread. Basically, people use "UML-ish" (or UML lite, or diet UML or "I can't believe it's not UML") style notation for informal entity design.

I completely agree that diagram generation from an existing codebase is a good way to get a high level overview. It can also be useful in identifying potential issues (super deep inheritance hierarchies, god classes, etc).

As for VS2010, I think the diagramming tools are based on the same engine that generates the intellisense, so basically, it's pretty good from .net and sucks for C++. Could be wrong about that though.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
Yeah, I agree to that. There's unfortunately no option for example to ignore forward declarations. Resulting in no diagram at all ):

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement