I’ve been working on a tool called Hairball to track setter and constructor injection, and use of singletons in Java code. Right now, the tool is capable of creating dot diagrams (for use with GraphViz) and graphml diagrams (for display in yEd).
My initial motivation for hairball was as a tool to help me understand potential problems in my code bases – spot god classes, code that is hard to test, odd dependencies. The tool purposely doesn’t make any judgments about code bases – it just gives you the diagrams. What you do with them is up to you.
The first version doesn’t contain support for tracking of singleton dependencies, and the setter and constructor injection should very much be considered a first stab – so I could do with some beta testers. I’m looking to track down false positives and negatives, as well as get some general feedback. Is Hairball it easy to use? Does it misdetect dependencies? Can you read the diagrams? Does it blow up when trying to run on your mammoth code base (I’ve done nothing to tune performance)?
Future Features
I have a few more features I’d like to add, including:
- Singleton detection
- Displaying inheritance
- Support spotting attribute injection from frameworks like Picocontainer or Guice
- Overlaying other metrics (e.g. colour based on Emma output, make nodes taller based on number of instructions in the class)
The feedback I get will very much determine what gets added next.
Hairball is available now for download.