It's payback time! Technical debt rating with NDepend

It's payback time! Technical debt rating with NDepend

Tech debt, a.k.a the to-do list. A list of things we would like to have done differently/better but constraints meant we couldn't. Often tech debt is the result of other tech debt! NDepend want to help you tackle it with their new feature.

Disclaimer: My licence for this product was supplied by NDepend, but this is an unbiased review based on my usage so far.

It's OK we all have it

Every project has technical debt, it's perfectly normal. Time, money, complexity, are often reasons why we have to make compromises in our code base and incur technical debt. What is not OK, is not managing that debt. If we let tech debt get out of control it can get to the stage where we have to do a massive rewrite. This can be costly, time consuming and hinder the cadence of the project, preventing new features being added. In the same way that money debt must be paid back so must tech debt. The longer it is left the higher the cost to pay back, tech debt is not interest free!

How to manage it

I understand that I need to manage my technical debt in order to keep my project healthy but how do I do that? As good developers we create a ticket on our project management system, which gets put on the backlog and buried by the project manager. NDepend to the rescue!

One of the new features in NDepend is smart technical debt estimation. All the default rules that are used to analyse your project now calculate an estimated technical debt score in man hours. This is measured by two metrics

  1. The outcome of the particular rule
  2. The percentage of test coverage

I previously wrote about how test coverage should be the first thing you set up, and this is a very good reason why. The more information NDepend has the better the estimation will be.

The new tech debt information can be seen on the NDepend dashboard

The NDepend dashboard

or the report

The NDepend report

This particular project has an orange rating of D, so there is some work to be done. However, you can see that the technical debt percentage has dropped from 40.88% to 26.53% which was down to me fixing all the failing tests.

On the dashboard you will also notice a couple of trend charts showing technical debt over time and percentage of debt and test coverage. I like these as you can easily see the trends over time, key to monitoring the health of your code base.

From the NDepend toolbar under Issues you can select Debt and Issues per Rule. This will give you a list of violated rules and their cost in technical debt.

The NDepend toolbar menu

How accurate is it?

The technical debt cost is represented in man-hours and is an estimation of how long it might take to complete.

The tech debt tile was telling me it was 1 days (8 hours) work to improve my rating from D to C. So I thought I would go through some of my issue violations and see how long it would actually take.

I had 2d 5hrs worth of untested code debt, so this looked like a good place to start.

Squashing tomatoes

I've been using the Pomodoro Technique a lot recently and the PomoDoneApp keeps a log that I can look at and see how many pomodoros I've done. So tracking the time I spent was easy and accurate.

So how did I get on?

I squashed just under 5 hours of pomodoros writing tests in an attempt to bring my debt rating down to a respectable level. Running the NDepend analysis again, these were the results.

The NDepend tech debt tile The NDepend coverage tile

As you can see I am still on a D rating but the effort to reach C has reduced down to 4h 45mins. Given that the original estimate was 1 day (8 hours) I would say that it is pretty accurate.

The NDepend debt and coverage charts

We can also see from the dashboard that the code coverage for the project has increased and the charts for Debt and Percentage Coverage and Percentage Debt are all heading in the right direction. There is still a fair amount of work to do to improve the health of this project but with NDepend I can monitor and track it to make sure all the good work isn't undone!

Summary

I'm really taken by NDepend's new tech debt feature. I see this as a really powerful tool to help you quantify technical debt easily and accurately. Having tested the estimations I have confidence in the times shown and am happy to use these. As with everything in NDepend you can tweak the tech debt settings to suit you, your team and how you work.