Under the Bridge

Dependency Graphing

Here’s a little script to help you delight in/be horrified by your program structure:

nst / objc_dep

…So how do we achieve loose coupling in our own code? Well, at first, we need to get a better idea on the current coupling. Let us define class dependancy: class A depends on B iff class A imports class B header. With such a definition, we can draw a graph of dependancies between classes by considering the Objective-C #import directives in each class. We assume here that the files are named according to the classes they contain.

I wrote objc_dep.py, a Python script which extracts imports from Objective-C source code. The output can then be displayed in GraphViz or OmniGraffle. You can then see an oriented graph of dependancies between classes…


Just the thing to hopelessly confuse those documentation-insisting project managers!

h/t: @jomtwi,@myell0w, maniacdev!  


Open Source Tool For Automatically Graphing Objective-C Class/Instance Details