Visual walkthrough — Technical debt — types, managing
This is the visual companion to the parent note. We rebuild its central result — the repay rule — starting from nothing but "work takes time."
Step 1 — Draw the thing we are measuring: time per change
WHY start here? The parent note talks about "interest" and "principal" in dollars, but a dev team doesn't feel dollars — they feel days. If we measure in days, every symbol becomes something you can literally point at on a calendar. We pick time because it is the quantity that actually changes when code is messy.
PICTURE. Look at the figure. The left bar is the time to make one change if the code were clean. We give that height a name: (read "C-zero" — the cost of a change, in the 0-mess baseline case).
Step 2 — What a shortcut does: it makes the bar taller
WHY a fraction, not a fixed add-on? Because the slowdown scales with the work. A messy module makes a big change much worse and a tiny change a little worse — roughly in proportion. So we say the mess multiplies your time by "one whole clean amount, plus some fraction extra." That fraction is a new symbol:
PICTURE. The clean bar had height . The messy bar is that same plus an orange slice of height stacked on top. Total messy height:
Term by term: is the work you'd always do; is the penalty tax the mess adds; is the whole stretched bar as a single factor.
Step 3 — One change is nothing. The pain is doing it again and again
WHY a new symbol ? Because the total waste depends entirely on how many times you come back. This is the single most important variable, and the parent note's whole ranking strategy ("fix hot code first") lives in it. We need to name it.
PICTURE. We line up copies of the messy bar. Each one carries its own orange "tax" slice. Stacking just the tax slices (ignore the clean part for a second) gives a tower of pieces, each of height .
Step 4 — Add up all the tax: the total interest
WHY a sum ()? The symbol just means "add these up." We use it because the total waste is nothing more than the same tax slice added once per visit — a repeated addition. Adding the same thing times is multiplication, which is why the sum collapses so cleanly:
Reading the : " to " means do this once for each of the changes. Since every slice is the identical size , adding of them is just .
PICTURE. The tower of orange slices from Step 3 fused into one tall orange block, labelled . That block is the total interest — the whole page hinges on its height.
Step 5 — The other option: pay it off once. Meet the principal
WHY a single up-front cost? Because refactoring is a one-time job: you fix the mess, and the fix stays fixed. So it's not multiplied by — it's paid once. That deserves its own symbol.
PICTURE. Two side-by-side towers. Left ("carry the debt"): the tall orange interest block . Right ("pay the principal"): a single teal block of height , and then flat clean bars forever after.
Step 6 — Compare the two towers: the repay rule
WHY the base costs cancel (the algebra behind the picture). Write the full time each path costs across the future changes:
- Carry the debt: every change is a messy bar , done times ⇒ .
- Pay the principal first: one-time , then every change is a clean bar , done times ⇒ .
We refactor when paying is cheaper:
Both sides carry the identical base term — the real work you must do either way. Subtract from both sides and it vanishes, leaving only the parts that actually differ:
That cancellation is the whole point: the base work is unavoidable and doesn't help you decide, so it drops out — only the one-time fix versus the total interest remains.
The break-even case . When the two towers are exactly equal, both paths cost the same total time — you are indifferent: refactoring neither saves nor loses days. The scale sits perfectly level. Because a refactor also buys you cleaner, safer code (fewer future surprises, easier onboarding) at no extra time cost here, many teams break the tie in favour of refactoring — but strictly by the time-arithmetic alone, it is a genuine coin-flip. That is exactly why the rule uses a strict : it only fires when there is a real, positive time saving.
PICTURE. A balance scale: teal on one pan, orange on the other. Whichever pan sinks lower is the more expensive path — pick the lighter pan; if they balance, it is the break-even tie.
Step 7 — The edge cases (never leave the reader guessing)
Case A — cold code, (you'll never touch it again). Right side . The rule needs , impossible (). So never refactor. ✅ Matches intuition: why clean a room you're about to demolish?
Case B — very hot code, large. Right side grows without limit while stays fixed. Eventually is always true ⇒ always refactor high-traffic code. ✅
Case C — no mess, . Right side . Rule needs ⇒ never "fix." ✅ There's nothing to fix; means the code isn't actually slowing you down.
Case D — free fix, . Rule becomes , true whenever and ⇒ always do a costless cleanup. ✅ Of course — a free improvement is pure win.
Case E — the tie, . The two towers are exactly level. Strictly, the rule does not fire ( is false), so pure time-cost says "indifferent." ✅ You lose nothing either way; tip-breakers (safety, morale) decide.
PICTURE. The orange interest tower drawn at four heights (n=0, small, large) against a fixed teal line — you can see the crossover point where the decision flips, and the exact height where they balance (break-even).
Step 8 — Plug in real numbers (the parent's worked examples, visually)
PICTURE. The two main examples as two little scales — Example 1 tips toward "refactor," Example 2 tips toward "keep."
The one-picture summary
Everything above, compressed: the clean bar → stretched by mess into → repeated times → the orange interest tower → weighed against the teal principal . When teal is lighter, you refactor; when they balance, you're at break-even.
Recall Feynman retelling — the whole walkthrough in plain words
Every time you edit code, it takes some days — call the clean amount . If someone took a shortcut earlier, you have to dig through the mess first, so it takes a fraction longer — that extra dig-time is the interest. One dig is no big deal. But if you'll come back times, you pay that dig-tax times over, totalling — a tall orange tower of wasted days. Instead you could stop once and clean the mess for good; that one-time cleanup costs — a teal block. Both paths still make you do the real work , so that part cancels — leaving just a race between and . If cleaning () is cheaper than all that future digging (), clean it. If they're exactly equal, it's a wash — flip a coin (or lean on the fact that clean code is nicer to live with). If the code is cold () or already clean (), the orange tower is zero-tall, so never bother. That single comparison, , is the entire art of managing technical debt.
Recall Quick self-check
What does do to the repay rule, and why? ::: It makes , so is required — never satisfied. Meaning: if the mess causes no slowdown, there's literally nothing to repay. In Example 1, what is the net saving from refactoring? ::: days. Why is the interest a multiplication rather than a big sum written out? ::: Because every visit costs the identical tax slice , and adding an identical thing times is multiplication by . What happens at the break-even point ? ::: Both paths cost the same total time — you are indifferent; the strict means the rule does not fire, so tie-breakers (safety, quality) decide. Why does the base cost drop out of the comparison? ::: It appears on BOTH sides (the real work you do either way), so subtracting it from both sides cancels it — only vs decides.