views:

686

answers:

9

A sort of follow up/related question to this.

I'm trying to get a grip on a large code base that has hundreds and hundreds of classes and a large inheritance hierarchy. I want to be able to see the "main veins" of the inheritance hierarchy at a glance - not all the "peripheral" classes that only do some very specific / specialized thing. Visual Studio's "View Class Diagram" makes something that looks like a train and its sprawled horizontally across the screen and isn't very organized. You can't grok it easily.

I've just tried doxygen and graphviz but the results are .. somewhat similar to Visual Studio. I'm getting sweet looking call graphs but again too much detail for what I'm trying to get.

I need a quick way to generate the inheritance hierarchy, in some kind of collapsible view.

+4  A: 

A good UML tool should do the trick.

Here is a list of generic UMl tools: http://en.wikipedia.org/wiki/List%5Fof%5FUML%5Ftools

There are lots out there, all with varying feature sets. Try playing with a few to see if you get the output you desire. If they free ones fail you, you might have to shell out for a good commercial grade UML tool

Fuzz
+4  A: 

Why not just do it manually, it is a great learning experience when starting to work with a large code base. I usually just look at what class inherits from what, and what class contain what instances, references or pointers to other classes. Have a piece of paper next to you and get drawing...

navigator
I actually ended up taking the train diagram and examining it. Then I drew a new diagram. A rewarding experience!
bobobobo
+3  A: 

You can try CppDepend, it doesn't create a class hierarchy like Doxygen does but it can show 'the big picture' for your project, it also shows some code metrics.

Serge
+1  A: 

Try Source Insight it is possible to configure the depth of the generated graph in this tool.

See also http://stackoverflow.com/questions/1245979/c-c-call-graph-utility-for-windows-platform

Jeff Leonard
+2  A: 

Instead of going into the full Class Designer tool, just use the "Class View" or the "Object Browser" in Visual Studio - they present fully collapsible class heirarchies.

Michael Burr
A: 

What's your definition of 'main vein'? You either want a graph reducer or skeletizer (you could find or write one and apply it to what Doxygen and the rest produce) or, 'main vein' has something to do with the function of the code and, I don't think an automated tool can help you with that. Unless you can point out to it 'These are the important bits that do input and output, show me only elements that are one or two steps away from the paths between these'. Hum, sounds like a cool tool to write :)

... the inheritance hierarchy, in some kind of collapsible view.

again, a sweet idea for a tool!

JDonner
+2  A: 

Check out SourceNavigator, it's open source, works on a bunch of platforms and has a Hierarchy Browser, a Class Browser, a Cross-Reference Browser and more that will allow you navigate and understand the code.

I'm using it for some time now especially when I have new code to go through and understand.

Eugen Constantin Dinca
+1  A: 

I've had most success with valgrind and kcachegrind to do this. You run valgrind against your debugging binary, perform whatever actions your interested in, then import the output into kcachegrind to see everything you'd ever want to know about who called what, how often, and when. Plus, because your doing it dynamically, it catches cases that static analysis likely wont.

I've also had some success using Enterprise Architect's reverse engineering features, although this doesn't end up nearly as nicely (but you get a workable UML model which is nice!).

And finally, a tool called "Understand". This is pretty good at static OO analysis, but I think quite pricey and not that widely used.

Scott
+2  A: 

For a reasonably priced commercial product, you may want to check out SolidSX from Vizlogix (www.vizlogix.com). (If you are outside of North America, go to SolidSource -- www.solidsourceit.com.)

It generates a radial diagram that can be collapsed and expanded. It also integrates with Visual Studio (both BSC and .NET).

Ken Boyer
+1 for weirdness and outlandishness :)
bobobobo