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
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.
1