Rob Smyth

Wednesday, 11 July 2007

A Metric To Measure Legacy Code Debt

It is not uncommon for a project to have 'legacy' code. That is, code that has poor health usually due to poor structure. This code makes it harder to add functionality. So if the team is to refactor this code as it goes to improve its health how does it measure its progress? How does the project manager measure the debt? If we cannot measure the benefits how do we justify the cost?

In the project I'm currently on we at least have the luxury of identifying this older code as code written without unit tests (using TDD). So we wonder if we can measure the debt by unit test (not User Acceptance Tests) coverage. This allows us to have a metric to say what % of our code is what we call 'legacy' code so we can then track this against our velocity. We expect our velocity to rise as the % falls. If it does not then we have an early indicator that perhaps our efforts to refactor the code is not productive.

This will be interesting.

No comments: