Technical Debt Measurement

Simulation
Introduced by
Ward Cunningham
Year
1992
Type
quantitative assessment
Family
Cost estimation

What does it do?

Technical debt is the accumulated cost of shortcuts, deferred maintenance and design compromises, which slows later development, raises defect rates and complicates deployment.

Technical debt measurement uses code-level signals such as complexity, duplication, test coverage gaps and maintainability indices to estimate that burden. The term was introduced by Ward Cunningham in 1992.

The intuition behind the method

Building software quickly often means taking shortcuts such as quick fixes, skipped tests, incomplete documentation and simplified architecture. These shortcuts save time now but leave work that must be done later. Like financial debt, the cost grows over time: changes to affected code take longer and carry more risk. Measurement aims to show how large this burden is and where it sits, so that teams can decide which parts to repay through refactoring, added tests or better documentation.

History

Ward Cunningham introduced 'technical debt' in 1992 as a metaphor for accumulated code shortcuts. The metaphor is documented in his OOPSLA 92 experience report on the WyCash portfolio management system, not in a formal study. Seaman and Guo (2011) discuss measuring and monitoring technical debt, and Tom, Aurum and Vidgen (2013) explore the concept of technical debt more broadly. Some measurement tools have combined several code signals into composite scores, as discussed under pitfalls.

When to use it

Use technical debt measurement when a team has version-controlled change history, defect or issue records and test coverage data, and needs to decide between refactoring and new feature work. It is most useful in codebases that have grown over several years, where the cost of changes has become a recurring concern. Avoid it for small or short-lived codebases, where the indicators are unlikely to reveal much beyond what developers already know. It is also a poor fit when the main concern is architectural, process or knowledge debt, since these metrics capture code-level debt only.

Limitations and considerations

  • There is no standard definition or metric for technical debt, so figures from different tools or organisations are not directly comparable
  • Code-level metrics capture only part of the debt; architectural, process and knowledge debt are hard to represent in them
  • Mapping debt indices to cost or developer time requires local calibration and may not transfer between organisations
  • Metrics cannot tell deliberate, justified shortcuts from mistakes, so a high score alone does not show that repayment is worthwhile

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Makes maintenance burden visible in terms that stakeholders can compare with feature delivery, provided the indicators are tied to observed effort
  • Supports refactoring decisions by locating where debt concentrates, so repayment can target specific modules rather than the whole codebase
  • Reveals recurring patterns, such as modules that repeatedly accumulate complexity or defects, which may point to process or architecture causes
  • Gives a basis for tracking debt across releases, so the trajectory rather than a single snapshot informs planning

Applications

  • Hypothetical case: in one module, complexity and coverage indicators are high relative to the rest of the codebase, and change records show that feature work touching it takes longer and produces more defects than comparable work elsewhere. The team proposes refactoring that module, supported by these indicator and effort records, before adding further features there. No figures are implied by this example.
  • Locating the modules that account for a disproportionate share of maintenance effort, so that remediation can be concentrated where it is likely to have most effect
  • Tracking debt indicators across releases of an open-source project, to show contributors and sponsors whether quality is being maintained as features are added
  • Using rising debt indicators alongside code review and defect escape data as one early signal of strain in a team, to be interpreted with caution

How it works

How it works

1

Collect source code metrics, change history, test coverage data and defect records from version control and issue-tracking systems. Where possible, use records covering comparable periods so that trends across modules can be read against each other.

2

Normalise metrics so that values can be compared more fairly across modules and over time within one language and one tool, and aggregate them to module and system level. Cross-language or cross-project comparison remains unreliable, because complexity and duplication are defined differently across languages and tools, so figures from different sources should be treated with caution. Flag candidate debt indicators such as high complexity, low coverage, frequent defects and high churn, noting that each indicator depends on how the underlying tool defines it.

3

Examine how indicator patterns relate to observed maintenance effort and developer productivity, for example whether high-complexity modules also show more defects or slower changes. Identify hotspots where indicators concentrate. Estimate remediation effort at this stage from expert judgement or past refactoring records, where such records exist.

4

Combine the selected signals, for example complexity, duplication, coverage and documentation completeness, into a debt index. No single formula is standard, so the team has to choose and state the weights. For example, after scaling each signal to a common range within the codebase, a team might give coverage gaps more weight than duplication if missing tests make changes harder to verify, and then sum the weighted values per module. The weights and scaling method should be recorded with the index so that later scores can be interpreted. Remediation effort may then be translated into cost or developer-time figures, which requires local calibration.

5

Rank modules by debt burden and prioritise repayment where high indicator values coincide with high maintenance effort. Read each indicator value relative to the team's own history and to other modules written in the same language and measured with the same tool, not against universal cut-offs, since thresholds are tool- and language-specific. A team should set its own cut-offs from the distribution of its past values, and should revisit them when the tool or its rule set changes. Report debt trends over releases to stakeholders, and check whether debt reduction is followed by faster delivery rather than assuming it.

Common pitfalls

  • Treating composite tool scores as objective measures; their values depend on the rule sets and assumed remediation costs built into each tool, such as SonarQube
  • Aiming for zero debt; some deliberate debt is a reasonable trade-off when delivery timing matters, so the aim is to track and repay debt rather than eliminate it
  • Equating debt with poor engineering; recorded, intentional trade-offs differ from mistakes, and measurement should keep that distinction
  • Judging teams by debt scores without business context, for example a team working toward a market deadline may rationally accept more debt

Frequently asked questions

How do I distinguish between technical debt and poor code quality?

Technical debt, as used here, is a deliberate trade-off: a shortcut taken for speed that carries a future maintenance cost to be repaid later. Poor code is the wider category of unintended defects or weak design. The distinction depends on intent and on whether the trade-off was recorded. Metrics cannot make this distinction on their own, so the team has to classify each case. Deliberate, recorded shortcuts are usually treated as debt to be repaid, while unintended problems are defects to be corrected.

What metrics should I track to measure technical debt?

Track multiple complementary metrics: cyclomatic complexity, code duplication, test coverage gaps, number of issues raised by static analysis, bug escape rates, and time-to-resolve bug fixes. Composite indices such as the maintainability index combine signals. No single metric suffices; aggregate multiple to gain holistic view.

How do I estimate the cost of paying down technical debt?

Estimate the effort needed for each high-debt module, using past refactoring records where they exist and expert judgement otherwise. Convert effort to cost using the team's own rates, and include regression testing and deployment work, which is easy to overlook. Splitting large repayments into smaller increments spread across planning cycles makes the estimate easier to check against actual progress.

Should I stop feature development to eliminate technical debt?

There is no fixed correct share of capacity. Ignoring debt indefinitely reduces the capacity available for new work, while eliminating all debt is not a realistic goal. Teams can set an allocation for debt reduction based on the debt trajectory and business priorities, and raise it temporarily when debt is blocking planned features.

Related methods

Sources

  1. Cunningham, W. (1992). The WyCash Portfolio Management System. OOPSLA 92 Experience Report.

    Open publication reference
  2. Seaman, C. B., & Guo, Y. (2011). Measuring and monitoring technical debt. Advances in Computers, 82, 25–46.

    Open DOI reference
  3. Tom, E., Aurum, A., & Vidgen, R. (2013). An exploration of technical debt. Journal of Systems and Software, 86(6), 1498–1516.

    Open DOI reference