Legacy Code¶
Legacy code is code you cannot change confidently; the first task is to create evidence and seams, not rewrite it.
flowchart LR
J[Junior: characterize behavior] --> M[Middle: introduce seams]
M --> S[Senior: migrate safely]
S --> P[Professional: portfolio modernization]
flowchart LR
Change --> Identify[identify change point]
Identify --> Break[break dependency]
Break --> Test[characterization test]
Test --> Modify[minimal change]
Modify --> Refactor --> Verify
| Level | Guide | You are done when |
|---|---|---|
| Junior | Make one safe change | You can capture existing behavior and change it with a focused test. |
| Middle | Create seams | You can isolate dependencies and improve design incrementally. |
| Senior | Modernize a system | You can stage migration while preserving compatibility and rollback. |
| Professional | Govern a legacy portfolio | You can prioritize modernization by risk, economics, and outcomes. |
Practice rule¶
Do not “clean up” behavior you do not understand. First capture what the system does, including surprising behavior that callers may depend on.