The UML Diagram They Don’t Teach You in School
I love class diagrams. When I’m knee-deep in spaghetti code there’s nothing better to help me understand what’s going on. I’ve even developed an obsessive-compulsive disorder which requires me to have a pen and paper handy at all times ‘just in case’ I need to jot down a little class diagram.
But recently I came across a bit of code that was resistant to the power of the class diagram. What if there are no significant class relationships, just a bunch of static methods?
Here’s what I mean:

The solution: a method call diagram. This diagram just shows a circle for each method and an arrow for each method call. From there it’s easy to see how to merge methods and simplify the call structure.
Obvious? Perhaps, but doesn’t seem to get the airplay it deserves.

August 1st, 2008 at 11:33 am (GMT)
Maybe a sequence diagram?
August 1st, 2008 at 4:35 pm (GMT)
Sorry about my bad english.
In the original sense, a sequence diagram would require at least one instance. Its semantic could be bent to mean something else, but would not be ideal.
As the code seems to be purely procedural, a procedural modeling language would probably fit better. Something like IDEF0 maybe?
August 1st, 2008 at 6:45 pm (GMT)
If you would like to write a tool making such visualization programmatically then take a look at GraphViz http://www.graphviz.org/
It has also java binding.
For the code parsing … well, the hight-end solution is ANTLR parser-generator, but simple regular expression would probably suffice.