Metrics about Jomic

$Id: metrics.xml 2176 2011-04-21 04:42:35Z roskakori $

Table of Contents

Code size metrics
Number of lines of source code
Number of program items
Design metrics
Distance from the main sequence
Test coverage
Style metrics

This article shows a few metrics and statistics on how the Jomic project evolved over time.

Jomic is a comic viewer written in Java. For this language, many tools exist to measure various metrics about source code and testing. While these reports are nice and useful, they do not show how these metrics evolve over time. However, this information would be much needed for several reasons. First, many metrics are pretty abstract and do not tell much at a particular point of time. What's really interesting is not a current value rather a trend shown by several consecutive values. Next, after a major reorganization of the code, they allow to check if the cleanup did change anything from a "distant" metrical view. And finally, the trends pointed out by the graphs in this chapter make it easier to see where parts of the code or testing process degenerated for a while, and refactoring or extension is needed the most.

So far, the metrics are derived from reports generated by Checkstyle, Emma and JDepend. With every release of Jomic, the current metrics are checked in the Subversion repository under /trunk/reports. A little Python script named collects and prepares them for gnuplot.

The actual value of design metrics is debatable, what's interesting however is how these metrics evolve over time. Here are three metrics computed by JDepend. The defintinions of these metrics are copied from the JDepend manual.

Test coverage measures how much of the code has been exercised by test cases.

There are different ways to format and organize source code and people often do not agree which is the best. Different styles have established. This is particular true for Java, which partially which tried to find a trade off between being a sensible programming language without being repulsive for people that grew up with C and C++. Because of that you can do a lot of stupid and ugly things wihtout getting slapped at the wrist by the compiler. In bigger projects, it is common to reduce the amount of chaos caused by people who grew up with C and C++ by using tools that point out stupid and ugly things in the source code.

One such tool is Checkstyle, which collects issues for every source file similar to compiler error. The only difference is that the code still compiles and runs, but at least you know that something is fishy.

The probably most meaningful metric from this is how many issues per source file are detected for each package.

In some cases, it is more useful to see the absolute number of changes, for example when moving files from one package to another or changing the Checkstye configuration.

Aparently, the number of issues increased a lot in late 2005. This happened because test code was included in the check. While this basically makes sense, some of the checks for normal source code do not go well with test code. For example, numeric constants are discouraged in application code because the meaning of the number is not clear. In test code however, many test cases uses numbers for expected values to compare the actual result with. In April 2006 this was fixed by adding approriate suppressors for test code checks.