May 5, 2011

Code Fitness - Visualize your java classes and identify complexity

Before refactoring a class, package or library  weak spots have to be identified. There are many code analysis tools providing insight, hints and alerts as to where someone should focus.

But before reading these metrics i'd prefer to have a quick look, an overview of the structure and the complexity underneath especially in a new project. Something visual would be ideal.

So jSizer comes to the rescue. It is a small swing-based app which reads a jar file and produces a graph depicting
packages' - classes' node hierarchy while effective coloring and shaping  helps to differentiate each node based on some vital metrics.

Some examples:






To interpret the graphs :

  • The Width of a class-node represents the number of fields.
  • The Height of a node represents the number of methods.
  • The Color represents LOC - lines of code.
So, quoting jSizer's author Robert Olofsson:
What you want to do is to look at the graph, find the big dark boxes and possibly refactor them.

No comments:

Post a Comment

Real Time Web Analytics