What the term means
Technical debt is the extra work each change costs because of shortcuts taken earlier. The shortcut saved time once, and every later change in that area pays a little for it.
Ward Cunningham coined the comparison in 1992. He likened shipping quick first-draft code to borrowing money, and the time spent working around it to interest.
How it works in practice
Martin Fowler gives a simple example. A feature that would take four days in tidy code takes six in messy code.
The extra two days are the interest. Cleaning up the mess might take five days, which Fowler calls paying off the principal.
For one feature, that doesn't pay. If several similar features are coming, it does, since each then takes four days instead of six.
The comparison has one limit. Financial debt grows every month, but technical debt costs you only when you work in that code.
Where it comes from
Fowler sorts debt by two questions: did the team know, and was it a sensible choice?
- Chosen and sensible. A team ships a simpler design to meet a launch date, and plans to tidy it later.
- Chosen and careless. A team skips good design because it thinks there's no time. That usually costs more within weeks.
- Unknown and careless. A team doesn't know good practice, and doesn't see the mess it's making.
- Unknown and sensible. A good team learns the better design only after building the system. Fowler calls this kind inevitable.
When to pay it down
Pay it down where the code changes often. That's where the interest adds up fastest.
Pay a little with each change, instead of saving it for one big clean-up. Fowler recommends this because nobody can measure the payoff of a large clean-up in advance.
Pay before a big piece of work in the same area. A new feature built on a tidy base costs less, and breaks less.
Leave it where nobody changes the code. Messy code that works and sits still costs you nothing until you touch it.
What it means for a buyer
You rarely see the debt itself. You see estimates that keep growing, and bugs that appear after each release.
Ask your builder to name the shortcuts they take on purpose, and to log them. Debt that's written down can be planned for and paid at a time you choose.
Common mix-ups
- Debt and bugs. A bug is the system doing something wrong. Debt is code that works but is slow and risky to change.
- Debt and old technology. An old framework isn't debt by itself. It becomes a risk when it stops getting security fixes.
- Debt and legacy. Enough debt, left alone long enough, is one way a system becomes legacy.
What to ask or check
- Which parts of the system are slowest to change, and why?
- Which shortcuts were taken on purpose, and is there a list?
- Is a little clean-up part of each change, or saved for "later"?
- Before a large feature, does the estimate include tidying that area first?
