Instant insight in hard to maintain code

Code analysis diagram

Usually I would not write about commercial software however today someone gave me this link of a great online service that use a very smart data visualization technique to give you direct insight in the parts of your source base that are more difficult to maintain.

We have blogged before that controlling your metrics is generally a good idea if you want your product to have a longer shelve life. The people behind this service use a different set of metrics than we usually track:

  • Code that is deeply nested. This is code that is hard to read for developers because they need to spend significantly more time to understand the code they are looking at. Also, changing deeply nested code (or code with a high complexity) has a higher risk of introducing bugs, for the simple reason that the code is hard to reach and, therefore, hard to test.
  • The code is subject to frequent changes. The more often code needs to be changed, the more significant it is that the code is maintainable. If you have hard to maintain code but it works, it is less of a problem as the negative effects of complex coding (bugs, time and money) are experienced less often.

On their site, they have a great interactive sample that shows you in one glance where the pain points in the open source android OS are. If you look at the image below, you immediately see that the ActivityServiceManager.java has good potential to be improved.

Image with sample output

This is in about 13 million lines of code. How about that? Pretty impressive if you ask me.

How did we do?

Since you can sign up for free we also gave it a try. I took the time to run it on a source base of one of our most complex projects. For those worried about intellectual property – there is no need to upload the actual code. Run a command line tool and it will analyze the code for you, and upload the results.

We were pretty pleased with the results.

Insight image that shows complexity in code