Visual Guice

I’ve been meaning/intending to try out Google Guice for awhile now; just saw they threw together a simple graph visualization for dependencies declared in Guice. Looks nice. I haven’t found a Spring visualization library yet that I like, and I don’t use one. I end up having to keep track of it in my head or by navigating through the config files. For some modules I’m working on, it’s kind of a hassle.

I don’t think visualization solves all problems, but back when I used to do more database design as part of project development, having a well laid-out ERD was a huge help in communication. If the database is well designed, part of which (in my mind) implies consistency, having an ERD at hand is like having a good street map when you’re toodling around town. ERDs save a lot of time finding your way around the database, planning and writing queries, and work as a focal point in discussions–I often found there was no problem in getting non-technical folk to pick up the model format and be able to make their points using the diagram. ERDs are actually pretty easy to keep in sync with the database, at least as far as entities, attributes, constraints and such are concerned. The biggest chunk of work was actually in laying the elements of the diagram out, always trying to keep the relationship lines from crossing each other. It was often worth a pat on the back if you found a layout that was neither too large (across many pages) nor too cramped, and which was easy to follow.

Which all reminds me of a great little tool written by Alex Moffat a few years ago for drawing UML sequence diagrams. The tool was called Sequence. I don’t think he’s been maintaining it, but other people have picked it up and incorporated it here and there; there’s a version that generates sequence diagrams from JavaDoc tags, for example. The best thing about Sequence was that Alex wrote a small DSL with which you could describe a sequence of operations very concisely. There is a parser for the DSL, though it exists purely to create the diagrams. I think Sequence is a great example of little tools that make your life a lot easier. Here’s one example of the syntax (taken from the help docs).

Comments.newComment {
  CommentFactory.newComment -> "the new comment" {
    Comment.<> {
      IDGen.nextID -> newId;
      Comments.getSize -> size;
  Comments.addToCache(the new comment);

which leads to this

Sample UML sequence diagram

This entry was posted in Uncategorized. Bookmark the permalink.