Visualising code dependencies

Started by
7 comments, last by hymerman 16 years, 6 months ago
I'm refactoring a lot of code at the moment, and a large part of my effort is being devoted to removing unnecessary or nonsensical dependencies. As I introduce intermediary classes and split things up into components though, I'm finding it hard to see which dependencies to concentrate on next, and figured that there's probably some tool that can help me with that. I imagined something that would just take a project file (VS2005), scan the source and headers, and generate some diagram showing what used, inherited from or contained what. So, my question is: does such a thing exist, and where can I find it?
Advertisement
You could use Doxygen with the option to generate include graphs as well, but that only gives you an include graph per file/class.

hth,
CipherCraft
Without a lot of effort you could turn the output of "makedepend", "g++ -MM" or even "cl /showIncludes /Zs" in to a graph in "dot format", for example. I've done something similar to calculate dependencies for my build system. I haven't turned the data in to a graph for visualisation, but the thought has crossed my mind.

You have to decide if you wanted to show transitive relations, or not, though.

If you want to grab the (python) code, head over to: http://www.mr-edd.co.uk/?page_id=4&page=3

Edd
You could try starUML which can generate UML diagrams based on c++ source files. It seems to do a pretty decent job of coming up with the class dependencies and hierarchy. I have used it a number of times to see the overall layout of the code bases I have had to work with.
CipherCraft: What I want really is to get an overview rather than individual dependencies; something to save me some time!

the_edd: Visualisation would be brilliant, but anything helps. Unfortunately the page you linked to seems to be about a build system...

vtchill: That seems brilliant, but I can't get it to work! I assume the functionality you're talking about is in "Tools -> C++ -> Reverse Engineer...", but this just generates a UML diagram of all the classes with no relations between them, all lined up horizontally. Is there something I'm missing? How do you use it?

Thanks for taking the time to reply :)

[Edited by - hymerman on October 4, 2007 5:13:16 AM]
Quote:Original post by hymerman
the_edd: Visualisation would be brilliant, but anything helps. Unfortunately the page you linked to seems to be about a build system...


Yes. There is Python source code in it to calculate dependencies. It's free for any kind of use, so you could adapt it to your needs, perhaps. I doubt it would take much work.
Ah right, fair enough. Thanks very much then, I'll see what I can do with it :)
Is the class diagram with VS2005 not suitable?
Wow, I didn't know about that. Very big thanks to you. Now I've just got to actually find it somewhere...

This topic is closed to new replies.

Advertisement