On this page
Why rewrites fail
A full rewrite tries to reproduce years of business rules at once, many of which nobody remembers adding. Meanwhile the business keeps changing, so the new system chases a moving target. Rewrites tend to run over budget, and they often launch missing small behaviours that turn out to be critical.
Capture what the system does today
Before changing anything, write tests around the current behaviour, including the odd parts. Record real inputs and outputs from production where you safely can. These tests become your safety net during the migration and, as a bonus, the documentation the old system never had.
Put a layer in front of it
Add an API or proxy between your users and the old system. At first it simply passes everything through. Once it is in place, you can send individual features to new code without users noticing anything except that things get faster and more reliable.
Replace in slices
- Pick a feature that is valuable and fairly self-contained
- Build it new, run it alongside the old one and compare results
- Route traffic to the new version gradually
- Keep every step reversible
- Retire the old code only when nothing uses it
Move the data carefully
Data is usually the hardest part. Plan migrations in small batches, check counts and totals after each one, and keep the ability to roll back. For a period, both systems may need to stay in sync, and that is normal.
Where AI can help
Modern AI tools are genuinely useful here: explaining old code, drafting tests for undocumented behaviour and spotting dead code. They speed up the work, but the engineering discipline above is what keeps the business running safely while it happens.