views:

1230

answers:

3

I am looking for a tool that can reverse engineer C++ to UML (and vice-versa). However, the crucial requirement is that it can correctly parse method (member function) bodies so that dependencies are correctly identified.

More Detail:

In the following code, ClassA is dependant on ClassB, so the UML tool needs to show this with a dashed line. There appear to be very few tools which can do this. I have tried Enterprise Architect, UMLStudio, Visual Paradigm, Borland Together, IBM Rational Architect and others.

class ClassB { static void methodStatic() {} void method() {} };

class ClassA { void method() { ClassB::methodStatic(); ClassB c; c.method(); } };

Edit: I have also tried StarUML. Note that Enterprise Architect is almost perfect; it correctly identifies dependencies from method parameter types and field types and all other features of the round-trip engineering seem to work well. However, it simply does not identify dependencies from method bodies, as in the example.

+2  A: 

BOUML claims to perform C++ code generation and reverse engineering.

Soo Wei Tan
Sorry I tried this one. Thanks for the suggestion though. A lot of tools claim to do reverse engineering, but they fail to find dependencies.
JohnMcGee
+1  A: 

i believe starUML do that. Best of all, is open-source.

Abel
Sorry but as far as I can tell (from testing), it doesn't find dependencies like in my example. However, the fact that it is open-source is a good point, since I should probably look into how easy it would be to add the feature I need (no doubt it will be difficult).
JohnMcGee
startUML does a remarkably bad job of laying out a few dozen classes in a class diagram. From testing it, I find that it routinely puts classes 'off the map' as it were. Thus it creates a class diagram, but limits the size of the diagram, so that many classes simply go off the side of the window 'space'. The layout diagram is quite rudimentary in my opinion.
C Johnson
+2  A: 

There are a few tools that allow a graphical presentation of your code. Doxygen for example does a good job.

However, C++ code (C++ being a multi-paradigm language) often does not match the typical idioms described in UML. So chances are that your C++ doesn't code fit in a typical UML diagram. I think this explains why there are no really good UML tools for C++. At least I haven't found any yet.

StackedCrooked
I believe that one of the reasons this is so hard to find is because C++ is such a difficult language to parse. However, as explained in my edit, some tools actually do a very good job except for the dependency discovery. In fact, even several UML tools for Java that I have tried fail to identify dependencies correctly, which I think of a key aspect of a UML class diagram.
JohnMcGee