2009-04-14

Ben Hyde's project dependency graph

Ben Hyde writes about clbuild and has a very nice graph of project dependencies in his post.

His approach is extraordinarily simple and uses a small Lisp program to parse clbuild's dependencies file and write out a .dot file. Of course, using Graphviz is a well-known approach for this kind of dependency diagram. Bill Clementson mentioned Richard Newman's graphs a few years ago.

But Ben's graph is a fresh take on this because of the way it uses clbuild's recorded dependency information, which shows dependencies of projects rather than dependencies of systems. What's the difference between projects and systems? Lisp projects often contain multiple .asd files.

Before thinking about the details of that distinction, let's look at the picture. Here's his graph, showing Hunchentoot, Drakma, cxml, and others:

Observations:
  • Yes, there's a lot of Babel in there. (It deserves it!)
  • The project dependency graph is not transitive. Note how CXML depends on Babel, which in turn needs Stefil. But CXML itself does not depend on Stefil. How can that be? It's because the system CXML depends only on the system babel. And that's not where the use of Stefil comes from. It's actually just babel-tests that needs Stefil, and that isn't needed when you're compiling CXML.
  • Where there are indirect dependencies, the graph shows them in full. Note that CL+SSL has an arrow to babel here, although it doesn't use it directly. This indirect dependency is due to its use of CFFI.

While probably not suitable for all dependency graphs, I think that this explicit display of indirect dependencies gives very nice results in this case, because it highlights commonly used libraries like Babel more than an ordinary graph would have done.

You can download his code at github. Note that you don't even have to download the projects that you want to compute a graph for, if you replace the call to directory with any other test of your choice.

2 comments:

Unknown said...
This comment has been removed by the author.
Unknown said...

FTR reddit submission. Also, i tried to do this too(except for functions instead) but i can't get graphviz(or was it it's dependencies?) to work :/. Similar problem with other stuff, like tinaa..