Technical debt and the trade-offs you defend
Debt raised as a complaint about quality loses to a deadline, so price each item in the other person's units, say what the feature costs with and without the fix, and write down any shortcut you take with an owner and a trigger
Product wants a feature built inside a module you know is fragile, and you think some of it must be fixed first. What do you bring to the planning conversation?
You can now take a feature from ticket to production and describe its design in a page. At senior level you also own the case for how it is built. Someone wants a feature by a date, and the code that has to carry it is old, thin on tests or copied in nine places. You are the person who knows. This chapter is about what you do with that knowledge in one conversation about one feature: how to say what the debt costs, which options to put on the table, and what to write down if you take the shortcut.
It is deliberately narrow. How a manager sizes a debt budget for a quarter, with a register, a fixed share and the argument with the product manager, is in technical decisions as a manager. How a product manager ranks a debt request against everything else is in prioritisation and saying no. Debt that spans several teams and years belongs to technical strategy, and how a company funds its platform and governs its architecture is in architecture governance and platform investment. The Software Architecture and Design course takes up technical debt as a portfolio in a chapter that is not yet written. Read those for the frame. This chapter is your move inside it.
The running case is Wrenpost, the messaging API with 55 engineers in seven teams. Its Routing team, eight engineers, owns the carrier integrations, which are the oldest code in the company. All figures below are illustrative.
The model: debt is a decision with a price and a date
Ward Cunningham introduced the metaphor in an experience report for OOPSLA 1992, about a portfolio system built in Smalltalk. He compared shipping first-time code to going into debt: a little speeds you up if you repay it, and the danger lies in leaving it unpaid. Martin Fowler’s later posts sharpen the picture in two ways that matter to you.
First, the interest is the extra effort each change costs because of the cruft, and Fowler notes that it is triggered by working in the affected code, not by the passage of time. A module you never touch charges you little. A module every roadmap item runs through charges you on every change. So the first question about any debt item is not “how bad is it” but “will we change it, and how often”.
Second, his 2009 quadrant sorts debt along two axes: deliberate or inadvertent, prudent or reckless. You will meet all four cells. For your purposes the useful cell is prudent and deliberate: you know the shortcut, you know what it costs and you choose it for a reason. The other cells are what you find in a codebase, often without knowing who put it there. The quadrant gives you a way to talk about debt without blame.
Your job rests on three habits.
- Notice and price debt in the code you are about to change. Not the whole codebase. The part the next two quarters run through.
- Offer options, not a demand. Put the feature’s dates with and without the fix on the table, so the decision belongs to the person who owns the roadmap.
- Leave a paper trail for every shortcut you take. A shortcut with no owner and no trigger is not debt in the useful sense. It is a mess you have agreed not to mention.
Which debt is worth raising
An engineer who raises everything is heard on nothing. Sort what you know into four piles before you open your mouth.
| Pile | Test | What to do |
|---|---|---|
| On the path | The next feature or two must change this code, or run through it | Price it now. Its cost belongs in the feature’s estimate, not in a debt budget |
| Costing you anyway | You pay in incidents, manual steps or slow changes, whatever the roadmap says | Price it and add it to the team’s register, with evidence |
| Dated | A runtime, vendor API or certificate stops working on a known day | Price it, set the date, fund it before the date |
| Quiet | Ugly, stable, rarely changed | Leave it. Write it down only if it will matter later. Complaining about it costs your credibility |
The first pile is the one this chapter is built around. Debt on the path changes the feature itself: its estimate, its risk and the shape of the options. Debt in the second pile is the register’s business, and the manager’s chapter covers how to fund it.
Wrenpost’s Routing team shows the difference. In July to September its median lead time was 4.3 days; the Delivery Reports team’s was 2.4. That is an indirect sign of interest in Routing’s code, though a lead time also reflects review queues and carrier sandboxes, and you should not offer it as proof. The harder evidence is closer to the code: the route selector, a single module with 14 carrier-specific branches, has tests for 3 of them. Retry logic was copied into nine places and has drifted. A product manager who asks for a new channel with a fallback is asking you to build on both.
Price it in their units
A price has four parts: the interest, the fix, the payback and the date. You can get all four from your own work in an afternoon.
Interest, as days per change. Take the last five changes to the module. Note how long each took from first commit to merge and compare with a typical change elsewhere in your team. If the module’s median is 6 days and the team’s is 3, the interest is 3 days a change. Multiply by the changes the roadmap will make. Then be honest about noise: if two of the five waited on a carrier’s test sandbox, remove that time and say that you did. A figure with its caveat survives a sceptical question; a figure without one does not.
Interest, as incidents. Count the incidents the shortcut caused in the last two quarters, and what each cost in engineer days and in customers. Fowler’s own caution applies: nobody can measure developer productivity objectively, so call it an estimate. Rules of thumb that you cannot source are better labelled as such than dressed up.
The fix, as a range. Use the method from breaking down and estimating work: low, likely and high, with the risk written. A fix with no range invites the answer “surely it is faster than that”.
Payback. The fix cost divided by the interest per quarter. A fix of 12 days against 6 days of interest a quarter pays back in two quarters. Items that pay back inside a quarter need little argument. Items with a date are funded by the date.
Translate into money only when the company does. Tallowmere’s engineers cost about ₦18m a year loaded, so a day is about ₦75,000, and finance will hear “₦1.35m a year” faster than “18 days”. Wrenpost’s product manager thinks in weeks of roadmap, so give her weeks.
Many incident-interest items are mechanisms ATLAS already teaches. A retry that can send twice is idempotency and retries with backoff and jitter; a call without a bound is timeouts. Name the mechanism in the register, so that the next engineer knows what the interest is made of.
The options when Product asks
Sakura, the product manager for channels, wants WhatsApp fallback routing built into the route selector this quarter, ahead of the WhatsApp channel launch in the third quarter of 2027: if a WhatsApp message is not reported delivered within two minutes, send the same content by SMS. The change goes through the route selector. Making the selector safe first takes three weeks. You have four answers, and each is right somewhere.
| Option | Right when | Wrong when |
|---|---|---|
| Debt first | The debt is on the feature’s path, and the date survives the delay | The date cannot move, or the debt is off the path |
| Feature first, with a dated debt item | The date is fixed, or the shortcut sits beside the feature and not under it | You cannot bound the shortcut’s cost, or its failure is a duplicate message to a customer |
| Half and half | The debt splits cleanly into a piece the feature needs and a piece it does not | The pieces cannot be separated, which is usually so |
| Decline | The feature’s value does not cover its cost, or the safe route misses the date by a margin that matters | Nobody has priced the alternatives yet |
Now the arithmetic for Wrenpost. The quarter has 13 weeks. Built on the selector as it is, the fallback is 4 to 6 weeks, likely 5. After the safety work it is 3 to 4, likely 3.5. Debt first therefore ships in about 6.5 weeks, in the middle of February. Feature first ships in week 5 and leaves a 3-week debt item for later. Three of Wrenpost’s large customers have said that fallback is a condition of their March renewals, which is week 12 or so. The date survives either route. That fact decides the case: when debt-first still meets the date, feature-first buys 1.5 weeks and costs you the risk.
The risk is specific. A fallback sends a second message. If the selector’s retry logic double-sends in some state, the customer receives a one-time passcode twice, and for a messaging company that is the product failing. Wrenpost has already seen what a repeat does to customers: the duplicate-webhook incident of 14 September 2026 reached 212 customers over 47 minutes. That was in Delivery Reports, not Routing, but it is the same class of failure. A feature built on unguarded retries inherits that exposure on its first day, and you pay the interest from the first commit instead of on a changing quarter.
Half and half deserves a word, because it sounds like a compromise and is usually the worst option. One engineer on each job means the safety work takes about six weeks, the feature is written on code that is changing beside it, and you meet merge conflicts in one module. As a rule of thumb, expect a week of rework. The compromise only works when the debt separates into a piece that makes the feature safe and a piece that does not. If it does, do the first piece, and that is debt first with a smaller scope.
The honest form of “decline” is rare and useful. It is not “no, the code is bad”. It is “at this price the feature does not clear the bar; here is what would change that”. Say it only when you have priced the alternatives.
Taking on debt on purpose
Sometimes the right call is feature first. The deadline is fixed, a launch, a regulator or a customer’s go-live, and the shortcut costs less than missing it. Then do it properly. Fowler’s prudent-deliberate cell is a sound choice only when the loan is recorded. A recorded shortcut has five parts.
- The shortcut, named. One sentence in the design doc or pull request description: “the fallback reuses the existing retry path and does not de-duplicate”.
- The price. What it costs while it exists, and what it will cost to fix: interest per quarter and fix days.
- An owner. A person, not a team.
- A trigger. A date or an event, such as “before the second carrier gets fallback” or “by the end of March”. An event trigger survives a slipping calendar better than a quarter does.
- A guard. A marker in the code that links to the ticket, and where you can, a test or an alert that fails when the shortcut’s assumption breaks. “No more than 2% of fallbacks send twice” is a test. “We will remember” is not.
Without the guard the register is a graveyard of good intentions. With it, the shortcut tells you when it has stopped being safe. A design doc for one feature has a place for this: the trade-offs and trigger section. Put the loan there, in the same document that records the design, so the next reader meets the shortcut and its owner together.
Notice what the loan does for the product manager. It turns “we cut a corner” into “we shipped five weeks earlier, and we owe three weeks by the end of March, and these are the signs that the loan is going bad”. She can plan around that. She cannot plan around a corner nobody mentioned.
Keeping the work reviewable
Fowler’s 2011 post on opportunistic refactoring argues that you should fix unclear code when you meet it, and that preparatory refactoring before a feature is part of the job. Take it seriously for the small things: a rename, an extracted function, a test around the line you change. For anything larger, split the work.
Put the preparatory change in its own pull request, with no behaviour change, then the feature on top. A reviewer can check a no-behaviour change quickly and with confidence, and the feature diff becomes small enough to read. This is the discipline from pull requests that get merged applied to debt. It also gives you an honest answer to “how long did the safety work take”, because it has its own pull requests.
A rewrite is a different thing. Joel Spolsky’s essay on Netscape’s rewrite is the standard warning, and it is a rule of thumb from one story, not a law. If a routing module needs to be replaced, treat that as a migration and plan it as one; Will Larson’s migration playbook, linked in the reading, is the place to start.
Agents change the calculation a little. Code written by an agent passes tests and still adds debt you did not decide to take, as working with AI coding agents explains. Count it as inadvertent and put anything you cannot explain on the register.
Where practitioners disagree
Is “debt” the right word? Some engineers prefer “cost of change” or “risk”, because debt suggests a lender and a schedule, and most of what a team calls debt has neither. The metaphor is useful because product managers understand it and because it supplies interest, principal and payback. Use it, and stay precise about which cost you mean.
Schedule it or fold it in? Fowler’s camp argues that refactoring belongs in every estimate and should not need a slot. Larson argues that the debt left after engineers have fixed what they can alone needs a migration and a plan. Both are right about different debt. The manager’s chapter lays out the four budget models and where each fails.
Refactor or rewrite. Spolsky’s answer is nearly always refactor. Others point to rewrites that worked, usually in code with a clear specification and a small surface. The test is whether you can state in a page what the old code must keep doing.
Numbers or stories. A figure persuades a finance reader, and a story persuades a product manager who has seen the incident. Bring both, in that order, and make sure the story is true.
Day to day
Debt work for a senior engineer is mostly small habits that make the big conversation short.
On every task, two minutes. When a change takes longer because of something you know about, write it in a running note: the item, the extra hours, the date. This is your interest log. It is the cheapest evidence you will ever collect, and it is the reason your figures are not guesses.
In every pull request. Label any shortcut with the ticket number in a comment, and say so in the description. Keep tidy-ups in their own pull request.
At design review. Read the trade-offs section for loans. Ask for the owner and the trigger. Give the same standard to your own document.
At planning, before the quarter. Bring the items on the quarter’s path, priced, with options and dates. Bring no more than three. Expect to hear a “no” and ask what would change it.
Monthly, thirty minutes. Review the register with your tech lead or manager: which loans are near their trigger, which items have new evidence, which should come off.
Each quarter. Report interest, not tickets. “The selector’s median change time fell from 6 to 4 days and duplicate sends fell from two a quarter to none” is a result. “We closed nine debt tickets” is not.
When a loan reaches its trigger. Raise it before the date, not on it. A trigger is a promise to a colleague, and the way to keep trust is to keep it visibly.
There is rarely a product manager between you and the founder, and the debt conversation is a hallway one. Most of your code is young, and a fast shortcut is often the correct trade, since the company may not exist in a year. Keep the discipline small: five lines in a file, each shortcut with an owner and an event trigger such as “before the first enterprise customer”. Do the full pricing only for the one item that could sink a launch, and tell the founder in a sentence.
This is where Wrenpost sits. A product manager and an engineering manager are both in the room, and the codebase is old enough to have real interest in places. The manager owns the debt budget, so your contribution is evidence: the interest log, the priced items and the options for the feature in front of you. Expect to do this once a quarter. The register is short, the loans are visible in design docs, and the credibility you build with accurate numbers pays when you ask for the three weeks.
Debt competes through a process: architecture review, a portfolio of tiered services, an annual planning cycle. Your item may need to reach a forum two levels up, with a form to fill and a deadline months before the work. Learn the process and file early. Dated items often attach to a service owner and a risk register, so make sure yours names a person who will still be in post at the trigger date. Watch for debt that crosses teams, which is not yours to fund alone and belongs with staff engineers and the governance forum.
Template
# Debt register: <team>, <quarter>
Evidence period: <dates> · Day rate or unit: <days / naira / weeks>
| # | Item and where it lives | Kind | Interest (with source) | Fix (low / likely / high) | Payback | Trigger | Decision |
|---|---|---|---|---|---|---|---|
| 1 | <what and where> | time / incident / date / dormant | <per quarter, from where> | <days> | <fix / interest> | <date or event> | fund / feature / leave |
## On the path of a planned feature
<Items to cost into the feature, and the feature's dates with and without them>
## Evidence caveats
<What you removed or doubted, and why>
## Not funded, and why
<Items left alone and the condition that would change that>
## Owners
<One name per funded item> WORKED EXAMPLE
Tallowmere is a fictional online pharmacy with 9 engineers and about 520 deliveries a day. A loaded engineer costs about ₦18m a year, so the register uses ₦75,000 a day (₦18m over 240 working days). Its senior engineer reviews the order-and-prescription service. All figures are illustrative.
| # | Item | Kind | Interest | Fix (days) | Payback | Trigger | Decision |
|---|---|---|---|---|---|---|---|
| A | Month-end stock count run by hand from a script | Time | 1, 2, 1.5, 1.5, 1.5, 1.5 days over six month-ends: mean 1.5 a month, 18 days a year, about ₦1.35m | 4 / 6 / 9 | 6 / 18 a year, about 4 months | Before the June count | Fund |
| B | Delivery-slot rules written twice, in the web and rider apps | Time and incident | 6 changes a year, each done twice (1 extra day), plus 2 bugs a year (1 day each): 8 days, about ₦600,000 | 7 / 10 / 14 | 10 / 8 a year, about 15 months | If slot changes pass 6 a year | Leave |
| C | Payment provider’s old SDK reaches end of support on 31 August 2027 | Date | None until then; payments stop working after | 3 / 5 / 8 | Not applicable | Done by 31 July | Fund |
| D | Catalogue-import module | Dormant | Untouched for 22 months; no interest | n/a | n/a | If it is changed | Leave |
Evidence caveats. The stock-count figures come from the engineer’s own log of six month-ends. B’s two bugs are the only ones found in the issue tracker for the year.
Not funded. B has a payback of 15 months and no date; it moves up if slot rules change more than six times in a year. D has no interest.
Owners. A and C each have one named engineer. Total funded: 11 days at the likely figure, about ₦825,000.
Now you
You are a senior engineer on Wrenpost’s Routing team. The quarter plan is due on Friday, and the team may spend 10 engineer-days a quarter on debt unless an item sits on a planned feature’s path. Five items are known. (1) The route selector has tests for 3 of 14 carrier branches. Its last five changes took 6, 4, 9, 5 and 7 working days from first commit to merge; the typical change elsewhere in Routing takes 3. The 9-day change waited 3 days on a carrier’s test sandbox, and the 7-day change waited 2. The roadmap has 6 more changes over two quarters. Fix: 12 days. (2) Retry logic is copied into nine places. Duplicate sends happened twice in two quarters, 6 engineer-days each. Fix: 18 days. (3) The route table is hand-edited about 3 times a month at half a day each; one wrong entry sent a country’s traffic down the wrong carrier for 40 minutes. Fix: 8 days. (4) One carrier retires its old API version on 30 June 2027. Fix: 10 days. (5) About 1,200 lines of dead code for a carrier dropped in 2021 sit inside the selector. Fix: 2 days. WhatsApp fallback will change items 1 and 2. Write the register.
Self-check
You are a senior engineer on Wrenpost's Routing team, eight engineers. Sakura, the product manager for channels, wants WhatsApp fallback routing built into the route selector this quarter, ahead of the WhatsApp channel launch in the third quarter of 2027: if a WhatsApp message is not reported delivered within two minutes, send it by SMS. Three large customers who will pilot the channel have made it a condition of their March renewals; the quarter has 13 weeks. Built on the route selector as it is, the feature takes 4 to 6 weeks, likely 5. The selector has tests for 3 of 14 carrier branches and its retry logic is copied into nine places, so making it safe first takes three weeks for two engineers, after which the feature takes about 3.5 weeks. Tomisin, who joined Routing a year ago, is worried about duplicate one-time passcodes. What do you propose?
- PAPER The WyCash Portfolio Management System Ward Cunningham, 1992
The original source of the metaphor. Read it to see that the debt was a deliberate choice, repaid by rewriting as understanding grew. Read: OOPSLA '92 experience report, the passage comparing first-time code to debt.
- POST Technical Debt Quadrant Martin Fowler, 2009
The deliberate or inadvertent, prudent or reckless grid. It gives you words for the debt you meet without turning the conversation into blame.
- POST Technical Debt Martin Fowler
Cruft, interest and principal, and the point that you pay interest by working in the affected code. This is the basis for pricing only the debt on your path.
- POST Opportunistic Refactoring Martin Fowler, 2011
The case for fixing unclear code as you meet it, including preparatory refactoring before a feature, with the caution to refactor only on green tests.
- POST Migrations: the sole scalable fix to tech debt Will Larson, 2018
What to do with the debt you cannot fix alone: treat it as a migration with a plan, and expect that unfinished migrations create more debt.
- POST Things You Should Never Do, Part I Joel Spolsky, 2000
The standard argument against rewriting from scratch, told through Netscape. Read it as one strong opinion, and test it against your own case.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.