4 ms·
Ask HN: using dependency diagram as the primary way of browsing code?
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?
- DenisM 17y agoThe 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.
- mahmud 17y agoYou mean like ASDF's :dependens :serial clause? http://common-lisp.net/~mmommer/asdf-howto.shtml http://common-lisp.net/~mmommer/asdf-howto.shtml http://constantly.at/lisp/asdf/ http://constantly.at/lisp/asdf/ [manual] I am usually thrilled about everything Lisp, but ASDF .. let's just say ASDF if fun fun fun.
- mahmud 17y agoCFlow does what you want: http://www.gnu.org/software/cflow/ 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".
- DenisM 17y agoThat 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.
- Zev 17y agoIn Xcode, look under the "Design" Menubar item. http://edr.euro.apple.com/documentation/DeveloperTools/Conceptual/XCodeDesignTools/Introduction/Introduction.html 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)
- DenisM 17y agoI can only get it to show inheritance diagram, not thedependencies diagram... am I missing something?
- DenisM 17y agoI think this does what I want but only for .NET: http://codebetter.com/blogs/patricksmacchia/archive/2008/09/09/interactive-code-dependencies-graph.aspx http://codebetter.com/blogs/patricksmacchia/archive/2008/09/... It also seems that Doxygen http://www.stack.nl/~dimitri/doxygen/diagrams.html http://www.stack.nl/~dimitri/doxygen/diagrams.html can generate the diagrams I need. Now all I need is to integrate this into XCode...