Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: using dependency diagram as the primary way of browsing code?
3 points by DenisM on Aug 8, 2009 | hide | past | favorite | 7 comments
XCode, as any other IDE I know, shows you the source files as a hierarchy of files and folders - a tree. Recently I realized that a better way to browse the source for me is a dependency diagram - a directed graph (this graph should be also be acyclic if I did everything right). So, I have a couple of questions for my fellow hackers:

1. Are there tools that help build and visualize dependency graphs? In particular, for Objective C but any other language is also interesting.

2. Are there IDEs (or IDE plugins) that use dependency graph as the primary way of browsing code, in lieu of the directory structure?




CFlow does what you want:

http://www.gnu.org/software/cflow/

It's primitive compared to the stuff you find in with more reflective languages, at least Common Lisp and Smalltalk, or for that matter binary analysis utilities like IDAPro.

But, theoretically, you could do that only with C-like languages and binary executables: i.e. languages that have a "program entry point".


That looks like control flow, not a dependency diagram. Control flow is too complicated for my purposes - I only want to see compile-time dependencies, really just visualization of #include directives would be perfectly fine.

Suppose class A comes with callback interface AC. Class B calls into class A and also implements AC, so that A can call it back if needed. In the dependency diagram I want to see dependency from B to A, but no dependency from A to B. The reasn is that A can be understood in isolation without B, but B can not be understod without A. I think compile-time dependency makes for a pretty good proxy of this "understanding" thing.


In Xcode, look under the "Design" Menubar item.

http://edr.euro.apple.com/documentation/DeveloperTools/Conce... looks like a decent introduction to the menu (note: I don't use this menu and only skimmed this doc, so no promises)


I can only get it to show inheritance diagram, not thedependencies diagram... am I missing something?


I think this does what I want but only for .NET:

http://codebetter.com/blogs/patricksmacchia/archive/2008/09/...

It also seems that Doxygen http://www.stack.nl/~dimitri/doxygen/diagrams.html can generate the diagrams I need. Now all I need is to integrate this into XCode...


The best I could do so far is to make a "rule" for myself that files in the list can only reference other files above them, not below them. This seems to preclude formation of cycles, but is still too coarse.


You mean like ASDF's :dependens :serial clause?

http://common-lisp.net/~mmommer/asdf-howto.shtml

http://constantly.at/lisp/asdf/ [manual]

I am usually thrilled about everything Lisp, but ASDF .. let's just say ASDF if fun fun fun.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: