Possible Duplicate:
How can I quantify the amount of technical debt that exists in a project?

If I wanted to help a customer understand the degree of technical debt in his application, what would be the best metric to use? I've stumbled across Erik Doernenburg's code toxicity, and also Sonar's technical debt plugin, but was wondering what others exist.

Ideally, I'd like to say "system A has a score of 100 whereas system B has a score of 50, so system A will most likely be more difficult to maintain than system B".

Obviously, I understand that boiling down a complex concepts like "technical debt" or "maintainability" into a single number might be misleading or inaccurate (in some cases), however I need a simple way to convey the to a customer (who is not hands-on in the code) roughly how much technical debt is built into their system (relative to other systems), for the goal of building a case for refactoring/unit tests/etc.

Again, I'm looking for one single number/graph/visualization, and not a comprehensive list of violations (e.g. CheckStyle, PMD, etc.).

  • 5
    Is this different than this other question? If so, can you elaborate on why it's different. – Thomas Owens Oct 2 '12 at 13:22
  • technical debt isn't the only factor in maintainability, a complex system with nearly 0 debt may still be harder to maintain than a simple system with a mountain of debt. – Ryathal Oct 2 '12 at 13:24
  • 1
    I honestly don't think this metric exists; I'd say there is no real agreement on "just how bad a violation of rule X" is (and how these interplay, etc) even at an informal level, let alone anything evidence based. And this is before you attempt to combine them into a single number, or consider things like "this code is beautiful, but you could have just used the built-in libraries". – Daniel B Oct 2 '12 at 13:38
  • Thomas - my question is very similar (thanks for the link didn't find that in my search!)...however, I'm wondering if there's one single statistic that more people recognize as the best "score" of technical debt/maintainability. This statistic would likely be a composite of other scores (e.g. complexity, duplication, etc.). – throp Oct 2 '12 at 13:41
  • Ryathal - thanks for highlighting the distinction. The logical assumption I'm operating on is "if TechnicalDebt then DifficultToMaintain"...but I understand that that does not necessarily mean "if DifficultToMaintain then TechnicalDebt". I'm looking for a metric for technical debt more than general maintainability. Something that indicates that the system has a lot of cruft built in (e.g. large methods, duplication, etc.), not just that it's large. – throp Oct 2 '12 at 13:49

Measure technical debt in terms of the amount of work required to eliminate the debt: if it'll take you and your team 3 months to get your code to the shape you'd like it to be in, you've got 3 team-months of debt. The cost of carrying the debt, like interest on a loan, is the amount of extra work that you incur due to the debt: if 50% of the work your team does in a month would be eliminated if your code were in ideal shape, that 50% is the "interest" that you pay on the debt.

Of course, it's impossible to know exactly how long fixing your debt will take until you do it, so it's only possible to measure these things precisely after the fact. And at any rate, the value in the idea of technical debt is simply to express the degree to which compromises and delayed work have or will become a problem for your project. A good accounting of the work required to reduce your debt will help in project planning, but other than that it may be more useful to express the debt in t-shirt sizes: small, medium, large, extra-large.


You don't mention what environment/language you want to provide metrics for. If you're using Visual Studio Ultimate, the code analysis tools provides a maintainability index as a score from 0-100 at the solution, project, class, and even method level.

Aside from that, a good indicator of maintainability is cyclomatic complexity. There are a number of tools that will calculate it for you automatically across multiple languages and environments. This question provides a list of them.

  • The code I'm looking at is Java, but I'd be interested in metrics for any platform/language in particular, or ideally something that cuts across all languages (like Cyclomatic Complexity). Thanks for the metion of Visual Studios maintainability index - I didn't know this existed. – throp Oct 2 '12 at 13:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.