In brief
Technical debt is the cost of future changes that grows because a faster or cheaper technical solution was chosen earlier and then never improved. It is measured not by a single number but by signals: the time it takes to make changes in a given module, the number of bugs and incidents, outdated dependencies, missing tests. It is repaid in a planned way: a debt register with owners and cost, a fixed share of team capacity, and repayment alongside business changes in the same part of the code.
What technical debt is
Technical debt is the difference between how a system is built and how it should be built for further changes to be cheap and safe. The debt metaphor was proposed by Ward Cunningham in a report from the OOPSLA conference in 1992: shipping the first version of code is like taking out a loan, and every later change in the unfinished code is a payment of interest.
Debt is not always a mistake. Deliberate debt, e.g. a simplified version of a module ahead of a regulatory deadline, can be a good decision if it is recorded and has a repayment plan. The harmful kind is unnoticed debt: a dependency that has not been updated for years, a module nobody understands, a manual deployment step known to one person.
Types of debt worth distinguishing:
| Type | Example |
|---|---|
| Code | duplicated fee calculation logic in three places |
| Architecture | modules read each other's tables, every change has an unpredictable reach |
| Tests | no automated regression, every release needs a week of manual testing |
| Dependencies and platform | a library without vendor support, an operating system past end of support |
| Infrastructure and deployments | manual deployment from instructions in a document, environments that differ from production |
| Knowledge and documentation | one person knows the system, the documentation describes the state from five years ago |
How to measure technical debt
Debt is measured by its effects, not by code quality alone, because the business pays for the effects. Static analysis tools estimate debt in hours of work, but that number leaves out architecture, knowledge, and infrastructure. A better picture comes from signals from several sources at once:
Signals from the repository and the pipeline
- Lead time for a change in a given module compared with others: from task to deployment.
- Hotspots: files that change most often and at the same time have the highest complexity. That is where debt costs the most.
- Test coverage and regression time. A module without tests slows down every release.
- Age of dependencies and the number of known vulnerabilities in them.
- Share of deployments that had to be rolled back or fixed.
Signals from maintenance
- number of incidents and production bugs per module,
- time to restore service after a failure,
- number of people who can make a change in a given system (when it is one person, the risk is high regardless of code quality).
Metrics need to be compared over time and between modules, not treated as absolute values. We write more about which measures make sense in the article Software quality metrics that actually tell you something.
The debt register
A debt register is a list of known debt items, each with a description, a cost, and an owner. Without it, debt exists only in programmers' heads and does not reach budget decisions. A good register entry contains:
- What and where. "Commission calculation duplicated in the sales, settlement, and reporting modules."
- Interest. What it costs today: "every tariff change requires three fixes and two days of testing."
- Risk. What happens if we do nothing: "a discrepancy in amounts in the regulatory report."
- Cost of repayment. An estimate in days of work, with assumptions.
- Owner and review date.
Interest and risk are the language the business understands. "Refactoring the commission module" will not convince the board, but "every tariff change takes two weeks longer and risks an error in the report" will.
An example from an insurer: the policy system changes tariffs every quarter, and regression is manual and takes two weeks. The debt item "no automated tariff regression" has clear interest: a two-week delay and a risk of error with every change. Repayment, that is, automating the regression, has a calculable return.
How to repay debt without stopping development
Debt is not repaid in one big "rewrite the system" project but gradually and where the interest is highest. Proven approaches:
- A fixed share of capacity. The team devotes a set part of every sprint or quarter to items from the register. The share is agreed with the product owner and held, including before deadlines.
- The boy scout rule. With every business change in a given part of the code, the team improves what it touches: adds tests, removes a duplicate, updates a dependency. Debt disappears where the code changes, and that is where it earns the most interest.
- Tests first. Before refactoring an old module, you add characterization tests that lock in its current behavior. Without them, refactoring is guesswork.
- Gradual replacement. The module with the highest debt is replaced with a new one piece by piece, redirecting traffic, instead of stopping development for a year. We describe cleaning up module boundaries in the article on the modular monolith.
- External deadlines as an opportunity. End of platform support, a new regulation, or an audit is a moment when debt repayment has a natural budget.
A separate category is debt in long-lived line-of-business systems, e.g. on IBM i or a mainframe. There the biggest item is often knowledge: the system works, but the authors have left. We write about how to recover it in the article Documenting a legacy system when its authors are gone, and about choosing a modernization path in the article IBM i modernization.
How to talk about debt with the business
A conversation about technical debt works when it is about money, time, and risk, not the beauty of code. A few rules help:
- show the trend, e.g. the lead time for a change in a module grows from quarter to quarter,
- tie debt to business goals: a faster launch of a new product, fewer incidents, a passed audit,
- present the few items with the highest interest, not the whole list,
- after repayment, show the effect on the same measures.
B2Bnetwork engineers modernize line-of-business systems, build regression automation, and take over maintenance of older applications at banks, insurers, and in industry. The scope of services is described in the What we do section.
Questions and answers
Is technical debt always bad?
No. Deliberate debt, taken on to meet a regulatory deadline or to test an idea in the market, can be a sensible decision. There is one condition: the debt is recorded in the register, has an owner, and has a repayment plan. The harmful kind is unconscious, unrecorded debt whose interest grows quietly until every change becomes expensive and risky.
How much time should a team devote to repaying debt?
There is no universal number. The share depends on the age of the system, the number of incidents, and the pace of business change. More important than a specific value is that the share is fixed, agreed with the product owner, and protected from deadline pressure, and that its effect is measured on the same measures as the debt.
Do code analysis tools measure all technical debt?
No. Static analysis is good at detecting duplicates, complexity, and rule violations in code, but it does not see debt in architecture, tests, infrastructure, or team knowledge. It is worth treating its result as one signal among others, alongside lead time for changes, the number of incidents, and the age of dependencies.
When should you rewrite a system from scratch instead of repaying debt?
Rarely, because a rewrite from scratch means a long period without new features and a risk of losing the knowledge captured in the old code. It makes sense when the platform no longer has support and gradual replacement is technically impossible. It is usually better to replace the system piece by piece, with characterization tests and traffic redirection.