Monday, November 21, 2011

Visualising your technical debt

For non developers:

Technical debt is an expression for the increasing level of difficulty a developer will have to introduce a desired change in the codebase. It encompasses lengthening estimates, increased unpredictability, increased number of side-effects, increased levels of developer fear, etc.
There are several reasons you might want to visualise your technical debt. I have tried to summarize them below:

  • Premise one:  You are a developer, and;
    • Parts of your code suck.
    • You don't want your code to suck as much as it does.
    • You have to convince someone that doesn't understand code to allow you to invest time in making it less sucky, or you just want to compare the suckiness of your code at two points in time.
  • Premise two: You are a code-illiterate manager who wants to know how sucky your code is.

So, how can you visualise the debt you have built up? Well, as debt is composed of various things such as the average cyclomatic complexity of your methods,  the average method length, test coverage, etc. etc. then you should be able to calculate these metrics and then combine them somehow to get some figures which you can then plot on a graph. And guess what? You can! Eric Dörnenburg has, with others, done some amazing work on Toxicity Charts and Tree Maps.
Figure 1: Example of a Tree Map. (Green is good, dark red is bad)
Figure 2: Example of a Toxicity Chart. (Short columns are good)
Using these visual aids even managers with no understanding of code can see where problem areas are in the code base and also compare the code base from one point in time to another. But they can also be useful visual aids within you team.

To find out more about these visualisation methods check out Erik's blog article and his excellent presentation of Software Quality - you know it when you see it.

No comments:

Post a Comment