Course map

Topic 157 / Advanced

Architecture evolution, modernization and technical debt

Chapter 9.5 · Data Patterns and Evolution

What and why

Every system's architecture is a decision made with yesterday's constraints — team size, traffic, and technology choices all drift, and treating the architecture as frozen just lets the gap between what the diagram says and what the system needs grow until a rewrite looks like the only option. Architecture evolution is the discipline of changing a live system's structure deliberately and incrementally — the strangler fig (→ 156) is one tool for it — while distinguishing deliberate technical debt (a conscious trade-off, tracked, with a payoff plan) from accidental debt (drift no one decided on purpose). Builds on: → 156 (strangler fig as the standing example of incremental evolution).

Diagram

Approach What changes Risk When it fits
Rehost Infrastructure only Low Code is fine; infrastructure is the problem
Replatform Swap a platform piece with minimal code change Low–medium One component is the bottleneck
Refactor Restructure code/boundaries without changing external behavior Medium Boundaries (→ 144, → 145) have drifted from the domain
Rebuild Replace a component or system with new code (often via → 156) High The existing code is a bigger liability than a rewrite's risk

How it works

  1. Record every significant architecture decision as it's made, with its context and trade-off (an ADR, → 57) — undocumented decisions are indistinguishable from accidents later.
  2. Track technical debt explicitly: what was deferred, why, and what would trigger paying it off — a conscious trade-off with a plan is debt; the same shortcut with no record is just decay.
  3. When a part of the system needs to change, choose the smallest approach that fits: rehost before replatform, replatform before refactor, refactor before rebuild — matching risk to the actual problem.
  4. Make structural changes incrementally and safely: expand-and-contract for schema changes (→ 189), feature flags to ship incomplete work dark (→ 188), the strangler fig (→ 156) for whole-component replacement.
  5. Validate each increment before the next: parallel-run the new path against the old where the risk warrants it, and only remove the old path once the new one has proven itself under real traffic.
  6. Re-evaluate the system's boundaries (→ 144, → 145) periodically against how the team and the business have actually changed — architecture that fit two years ago can be quietly wrong now, exactly as Conway's law (→ 145) predicts when teams reorganize.

Practical example

(illustrative). A team notices their "Orders" service now contains three unrelated responsibilities that grew in over two years, each deferred with a comment, never an ADR. Rather than a rewrite, they document the current state in an ADR, extract the most independent responsibility behind a strangler-fig facade (→ 156) over two sprints, validate it with a parallel run, then retire the old code path — paying off two years of undocumented drift in a controlled sequence instead of a single risky rewrite.

When to use it

  • Use when: a system's structure is measurably causing pain (slow changes, repeated incidents in one area, boundaries that no longer match the business) — evolve it deliberately rather than letting the pain become the justification for a ground-up rewrite.
  • Avoid when: the system works and nothing is straining — evolution for its own sake, with no named pressure, is the same forced complexity rule 7 warns against everywhere else in this book.
  • Failure scenarios: a full rebuild chosen because the existing code is unloved rather than because it's actually the bottleneck, discarding working behavior no one fully re-specified; technical debt with no record, discovered only when it causes an incident; architecture changes made without an incremental, validated path, repeating the big-bang-cutover risk the strangler fig exists to avoid.
  • Simpler alternative: for most strain, a targeted refactor of the specific boundary causing pain — not a rebuild — resolves it with far less risk; reserve a rebuild for when the existing system is a bigger liability than a rewrite's risk, with that comparison made explicitly, not assumed.

Practice

(Process kind — fill the template on a small real system; 25 min). Take a system you know that has accumulated some drift. For one pain point, fill in: (a) what changed since the original design, (b) which of rehost/replatform/refactor/rebuild fits, with one sentence why the smaller options don't, (c) the incremental path (what ships first, what's validated, what's removed last), (d) one piece of technical debt involved — deliberate or accidental, and what would trigger paying it off.

Done when the chosen approach is the smallest one that genuinely fits, and the incremental path has no step that requires a big-bang cutover.

Key takeaway

Architecture evolves deliberately and incrementally — match the approach (rehost → replatform → refactor → rebuild) to the actual pressure, track technical debt on purpose, and never skip straight to a rewrite without weighing the smaller options first. Done when you can: choose and defend a modernization approach for a real pain point, with its incremental, validated path. Used next in → 158 (Part 10 — security is the next lens architecture decisions get re-evaluated through).

References

A pattern language for microservices — see references.md.

Source directory

Search the guide