Sign in to follow this  

Visualising code dependencies

This topic is 3728 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'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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3728 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