Slashdot Mirror


Visualising Code Structure in Large Projects?

TheMaccLads asks: "I've recently joined a new C++ project, and it's in a terrible state. There are 100-odd source directories, dozens of libraries, and a couple of dozen executables and DLLs. Some executables pull in (i.e. compile themselves) the occasional source file from a library, instead of using the libraries. My job is to port a subset to unix, but I need a tool to visualise all the relationships between directories, projects, libraries, and so on, because my brain will overheat soon otherwise. Preferably a tool that will do it by parsing the MS Dev studio projects and workspaces, but if I have to write it myself in Perl, I will! Anyone know of any tools? Or suggest an approach?"

8 of 47 comments (clear)

  1. Rational Rose by Dr.+Bent · · Score: 1, Informative

    Rational Rose has some of what you're looking for, but the best way might just be a big, fat whiteboard, a digital camera (for taking pics of the whiteboard), and some elbow grease.

  2. Hmmm by Lord+Hugh+Toppingham · · Score: 2, Informative
    Software Emancipation's Discover product is pretty good at that, as is Takefive software Sniff++.


    Theres other products out there too, All are expensive.

  3. Doxygen by brenfern · · Score: 5, Informative

    I have used this, it is fantastic; it will work with your old C++ code straightoff, & also accepts javadoc-style comments. Handles the worst code elegantly. Draws pretty graphs for you. Does the bits of a programmer's job that really ought to be automated.

    1. Re:Doxygen by bitMonster · · Score: 5, Informative
      I agree. It works wonders on 3rd party sources too, even when they did not use any of the supported commenting conventions.

      Get it.

      I wish it supported python, which is the other OO language I routinely use.

  4. McCabe Visualization tools by Jack+Tanner · · Score: 3, Informative

    McCabe & Associates makes some software that will automatically create a graph for visualizing a large software project, even one using mixed languages. Their marketing department renames the software every other week, but that's what they do. Arthur Watson (PhD, Computer Science, Princeton) did their most interesting research a few years ago, but has since left the company.

    Their software will also help re-engineering and testing efforts: it'll tell you how complex your code is (and thus what parts of it are most likely to break), and it'll instrument your source code and show you what logic paths you've hit in your program during testing, and what code remains untested. It used to be pretty solid stuff (and pretty pricey!); I'd love to see some free/open software that does stuff like this.

    Disclaimer: I'm a former intern.

  5. CodeWright for mapping by andaru · · Score: 4, Informative
    If you are going to map out the project by hand, CodeWright from StarBase (formerly from Premia) is excellent.

    It is the best editor I have seen yet (multiple language support, totally configurable, excellent tech support), and it is great for navigating large projects. It parses all of the files in your project as text (so you can browse code that does not compile), and is a good complement to Dev Studio's build-based browsing.

    It integrates with Dev Studio, so the two editors and environments will update each other when you switch between them.

    I probably shouldn't admit this on /., but at one job, I had a Windows box dedicated to running CodeWright, editing QNX code over Samba. It was actually worth the extra box. At another job, I was using it to edit files for Sun and DEC UNIX (no Samba this time), and it was still worth it to ftp the files back and forth, rather than use what I could find in the UNIX world at the time.

    I know also that there is some really good code mapping software out there, but I can't give you any names off of the top of my head. Large sheets of paper really do the trick, though. I have seen people spend a lot of time with visio getting very little done, but I haven't used it myself, so don't listen to me and I'll shut up now.

    --

    Why is Grand Theft Auto a much more serious crime than Reckless Driving?

  6. Re:Am I missing something? by bitMonster · · Score: 2, Informative
    Yes.

    The class hierarchies are very sophisticated. For example, you can see a page with a summary of all the methods for a derived class showing where all of these methods are inherited from. The same view shows all the attributes on each method, such as virtual, inline, static, etc.

    There is also a whole section generated on include file hierarchies. You can see quickly where everything is declared without doing a bunch of greps to try to see how things fit together.

    Finally, the hyperlinking scheme is simply inspired. For example, it will even take you to the exact line of a header file that corresponds to a particular method (complete with syntax highlighting).

    Go look at it. It's not going to reverse engineer design documentation from the intent of the code, but it gives you a huge advantage over a big pile of C++ files. (If you think you are going to find a tool that does the former, you're smoking something.)

  7. Re:What I want... by MemRaven · · Score: 3, Informative
    Well, I've been using Visual SlickEdit (mentioned elsewhere in the thread) for a couple of years now as virtually my exclusive editor, and it runs on almost every platform I care about (Intel Linux, Windows, Sparc Solaris, FreeBSD, etc.). Its tagging goes way beyond what etags does, and has built-in reference analysis. Once you've built your tag database (which automatically updates when you edit a file in slickedit), you can choose to view references. You type in a tag (such as a method or variable name), it'll pop up a list of potentially matching tags (so if you have a lot of things named getName(), for example, it'll let you choose which one), and then it will display all code which references that tag. You can then double click on a code region to go straight to the file and area where that exists (although it shows you a few lines at a time normally). I think there's actually a keyboard shortcut to do that for a particular tag (just like you can automatically go to the declaration of a tag)

    Although this seems like a convoluted feature, it's extremely useful for doing any kind of refactoring work where you want immediate feedback analysis. You get to see immediately where everything is used, and it's got other tools which help with that as well (like the class browser and the like). (It also has Visual Basic-style autocomplete, which I absolutely love, because on large projects I never remember exactly what everything's named).

    Admittedly, you might not want to change editors just for this feature, but you might want to have it in your arsenal of tools for when you do need/want it.