Loslegen
Javaneer
Zurück zur Stufe
Stufe 6·Evolutionäre Architektur

Technische Schuld managen

Schuld als bewusstes Werkzeug, nicht nur als Schlamperei: der Schulden-Quadrant (klug/leichtsinnig × bewusst/unbewusst), Schuld sichtbar machen und ohne todgeweihtes Big-Rewrite abbauen.

14 Min. LesezeitFortgeschritten

Deutsche Übersetzung in Arbeit

Diese Lektion ist noch nicht ins Deutsche übersetzt und wird daher auf Englisch angezeigt. Der Rest der Seite ist vollständig lokalisiert.

Auf dieser Seite

Every evolving system accumulates technical debt - the gap between the code you have and the code the current problem deserves. Juniors treat debt as shameful failure to hide; seniors treat it as a financial instrument to manage deliberately. The metaphor, coined by Ward Cunningham, is exact: debt lets you move faster now in exchange for interest - the ongoing drag of working around the shortcut - which you pay until you repay the principal. The skill isn't avoiding all debt; it's taking it on wisely and paying it down before the interest crushes you.

Debt is a tool, not just a mess

The crucial reframe: some technical debt is a smart, deliberate choice. Shipping a simpler-than-ideal design to hit a market window, hard-coding a value you'll generalize later, skipping an abstraction until a second use case appears - these can be correct decisions that trade future cost for present speed. Like financial debt, it's leverage: dangerous when reckless, powerful when deliberate.

What makes debt bad isn't its existence - it's being invisible and unmanaged: shortcuts nobody recorded, interest nobody's tracking, principal nobody plans to repay. Debt taken knowingly and tracked is a tool; debt accreted blindly is decay.

The technical debt quadrant

Martin Fowler's debt quadrant classifies debt on two axes - was it deliberate or inadvertent, and prudent or reckless:

                 RECKLESS                        PRUDENT
DELIBERATE   "We don't have time         "We must ship now and deal
             for design"                  with the consequences" (a
             (dangerous - knowing         conscious, tracked trade-off -
              better, choosing worse)      the healthy kind)

INADVERTENT  "What's layering?"          "Now we know how we should
             (ignorance - the team         have done it"
              lacks the skill)             (learning - unavoidable, the
                                           best you could do at the time)
  • Prudent + deliberate is the healthy debt: a conscious trade-off you record and plan to repay.
  • Prudent + inadvertent is inevitable and fine: you did your best; hindsight revealed a better design.
  • Reckless + deliberate ("no time for design") is the dangerous quadrant - knowingly cutting corners without a plan.
  • Reckless + inadvertent (not knowing what you don't know) is why teams need to keep learning.

The quadrant's value: it tells you which debt to worry about. Prudent debt is managed; reckless debt is the problem.

Making debt visible and paying it down

Unmanaged debt is invisible, so the first job is visibility:

  • Record it where work lives - a // TODO: debt - hard-coded, generalize when we add the 2nd currency linked to a tracked ticket, a debt register, or issues tagged tech-debt. Name the interest (what it costs you) so it can be prioritized against features.
  • Measure it - static-analysis tools (SonarQube) estimate debt; a rising trend is a warning even if any single item is small.

Then pay it down continuously, not in a doomed big-bang:

  • The Boy Scout Rule - "leave the code cleaner than you found it." Small, opportunistic improvements every time you touch a file compound into steady repayment without a dedicated project.
  • Budget a slice of each iteration for debt repayment (say ~20%), so it's a routine cost, not an emergency.
  • Repay the high-interest debt first - the debt in code you change often costs the most (you pay its interest on every visit); debt in stable, rarely-touched code may be fine to leave (its interest is near zero).

Beware the doomed 'big rewrite' to clear debt

When debt gets painful, the tempting move is 'let's stop and rewrite it cleanly.' Big-bang rewrites are notorious for failing - they take far longer than estimated, freeze feature delivery, and often reproduce the original mess. Prefer incremental repayment: the Boy Scout Rule, refactoring alongside feature work, and the strangler-fig pattern (next lesson) for larger legacy replacement. You pay down a mortgage over time; you don't demolish and rebuild the house to escape it.

A credit card, used wisely or recklessly

Technical debt is a credit card. Used wisely, it's a genuine tool: you buy something valuable now (hit the launch date) that you couldn't otherwise afford, and you pay it off on a plan - the interest was worth the timing. Used recklessly, you swipe for everything with no intention of paying, the interest compounds silently, and eventually the minimum payments (working around the mess) consume all your income (velocity) until you can barely function. The difference isn't whether you use the card - responsible people do - it's whether the spending is deliberate and tracked with a repayment plan, or invisible and ignored. And you clear the balance by steady payments, not by declaring bankruptcy and starting your whole financial life over (the big rewrite).

Manage the debt, not just lament it

A team is drowning: a critical module is a tangled mess, slowing every feature. A senior proposes freezing all features for three months to rewrite it from scratch. Meanwhile, nobody tracks debt - shortcuts are taken under deadline and immediately forgotten. Critique the rewrite plan and prescribe a healthier debt-management approach, referencing the quadrant.

What's the healthiest way to think about and handle technical debt?

Key takeaways

  • Technical debt is a financial metaphor: a shortcut that buys speed now in exchange for interest (ongoing drag) paid until you repay the principal.
  • Debt is a deliberate tool, not just sloppiness - prudent, tracked debt is smart leverage; what's dangerous is invisible, unmanaged, reckless debt.
  • The debt quadrant (deliberate/inadvertent × prudent/reckless) tells you which debt to worry about: prudent debt is managed, reckless debt is the problem.
  • Make debt visible (tracked tickets, a register, static analysis) and name its interest so it can be prioritized against features.
  • Pay it down incrementally - the Boy Scout Rule, a budgeted slice each iteration, high-interest (often-changed) code first - not with a doomed big-bang rewrite.
War diese Lektion hilfreich?
Diese Seite auf GitHub bearbeiten