4.5.20 · D3Software Engineering

Worked examples — Technical debt — types, managing

2,836 words13 min readBack to topic

This page drills the repayment decision from the parent note until every possible input has been walked. The one weapon we use over and over is the rule of thumb:

Everything below is just this one inequality, poked from every angle. The figure is the whole page in one picture — study it before reading on.

Figure — Technical debt — types, managing

Read the figure carefully, because every example lands somewhere on it:

  • The flat coral line at height is your one-time fix cost . It is horizontal because does not depend on how many changes come — you pay it once, whatever is.
  • The rising lavender line is total interest . With and it climbs by days for every extra change, so it is a straight line through the origin with slope .
  • The two lines cross at the black dot, (that is Ex 3's break-even). Left of the dot the coral fix is dearer than the interest ⇒ keep the debt (labelled region). Right of the dot the lavender interest overtakes the fix ⇒ the mint-shaded "refactor wins" region.
  • Every worked example is really just the question "which side of that black dot am I on?"

The scenario matrix

Every case this topic can throw at you is one row here. Each worked example below is tagged with the cell it hits.

# Case class What makes it tricky Example
A Hot code ( large) interest dwarfs the fix ⇒ repay Ex 1
B Cold / dead code () interest ≈ 0 ⇒ never repay Ex 2
C The break-even point () tie — the indifference boundary Ex 3
D Zero interest () clean-enough shortcut ⇒ never repay Ex 4
E Partial fix (fix lowers , not to 0) compare two interest streams Ex 5
F Compounding / debt spiral ( grows over time) why "later" never comes Ex 6
G Real-world word problem (money + velocity) translate business talk into Ex 7
H Exam twist (classify + decide together) Fowler quadrant meets the inequality Ex 8

Case A — Hot code: interest dwarfs the fix


Case B — Cold / dead code: never repay


Case C — The exact break-even (indifference boundary)


Case D — Zero interest: the harmless shortcut


Case E — Partial fix: two interest streams

Real refactors often reduce interest without eliminating it. The inequality changes: compare doing nothing against fixing and then paying the smaller leftover interest.


Case F — Compounding: why "later" never comes

Earlier cases assumed is a fixed number. But debt often makes code worse over time — each unclean change piles on more mess, so grows. This is the debt spiral.


Case G — Real-world word problem: velocity in money

Business people speak in velocity and money, not and . The skill is translation, and the trap is defining correctly.


Case H — Exam twist: classify AND decide

The trap: an exam gives you a Fowler quadrant and an ROI decision in one question. They are independent — a well-managed loan can still be worth keeping.


Recall Quick self-test across all cells

Which factor being zero always kills a refactor case? ::: Any of or (or ) — the interest term collapses to zero, so no positive can be smaller. In the partial-fix case, what replaces the master inequality? ::: — you only "buy back" the reduction in interest. Why does compounding make "do it later" a trap? ::: grows with each unclean edit, so the interest line curves upward and crosses sooner — waiting increases the cost you're deferring. Does a Deliberate–Prudent classification mean you should repay? ::: No. Classification measures intent/awareness; the test decides repayment separately. Can be a fraction? ::: Yes — in practice is an estimate or expected value (e.g. a 30% chance of one edit ⇒ ); the inequality works for any .

See also: Refactoring, Test Driven Development, Coupling and Cohesion, Continuous Integration.