Rebuild, Refactor or Replace? What to Do With Old Software
The system works, nobody wants to touch it, and everyone has an opinion. A calm way to decide, the method that avoids a big-bang launch, and when to leave it exactly as it is.
BunnyDevs5 min readProduct
Somewhere in most companies there is a system everyone depends on and nobody wants to change. It was built years ago by people who have left. It mostly works. Each new request takes longer than the last.
The argument that follows is usually between "rewrite it" and "do not touch it". Both are often wrong.
First, find out what you have
Before any opinion, get facts. A short audit should answer:
- What does it do, and which parts are used? Logs often show that a third of the screens are never opened.
- Which versions is it running on, and do they still receive security updates?
- Where is the data, how clean is it, and is the backup real? Restore one and see.
- Which parts change often, and which have not changed in years?
- Who understands it?
- What did it cost last year, in money, hours and refused requests?
A week on this saves months later. It also calms the argument, because people stop debating a picture in their heads.
The four honest options
Leave it alone. If it is stable, isolated, patched and rarely changed, the best plan may be better backups and a written note. Old is not a fault.
Refactor. Keep the system and improve it from inside: tests, clearer structure, newer versions, faster queries. Right when the design is sound and the code is merely untidy.
Replace with a product. Right when the process is standard and good products exist. Many custom systems were built when there were no alternatives, and now there are.
Rebuild in stages. Right when the technology itself is the limit and the process is special enough to deserve custom software.
Choosing between them
| Sign | Points towards |
|---|---|
| Works, rarely changes, still supported | Leave it |
| Slow to change but the structure makes sense | Refactor |
| A good product covers most of it | Replace |
| Platform out of support, or cannot do what you need | Staged rebuild |
| Nobody can run it locally | Audit first, decide later |
Why the big rewrite fails
The plan sounds clean: build the new one, switch on a date, retire the old one. Then three things happen. The old system keeps changing, so the target moves. The new one must match years of small decisions nobody wrote down. And nothing is usable until everything is, so the date slips and confidence goes with it.
Some rewrites succeed. Very few finish when expected, and the business carries the risk on a single day.
The method that works: one slice at a time
- Put a door in front. Route requests through one entry point, so you can send any function to the old system or the new one.
- Make the old one safe. Version control, a staging copy, a tested backup, and tests on the paths that earn money.
- Choose a slice. Something valuable, separable and not the most frightening. Search, reports or customer notifications are common first choices.
- Build it beside the old one. Run both and compare the results on real data until they match.
- Send a little traffic. Then more. Keep the way back open.
- Delete the old part. This step matters. A system half moved and left there is worse than before.
- Repeat until what remains is small, or not worth moving.
Each slice delivers something. If priorities change after the third, you have three real improvements instead of half a rewrite.
Data is the hard part
Code can be rewritten. Data has to be understood. Expect duplicates, blank fields that mean something, dates in three formats, and a status called "other" that holds a quarter of the records.
Plan the migration early. Write down the rules, run it several times on copies, and reconcile totals with the people who know them. Never let the first full run be the night before launch.
What to fix first, whatever you choose
Some jobs are right in every case, and they are cheap.
- A backup that has been restored successfully.
- The code in version control, with a person who can deploy it.
- Passwords and keys moved out of the code.
- Monitoring, so you hear about problems before customers do.
- A one-page map of what talks to what.
If nothing else happens this year, do these.
Talking about it inside the company
"Technical debt" does not move budgets. Costs do. Say that the last three requests took six weeks instead of two, that the server's operating system stops receiving updates in spring, that one person is the only one who can fix invoices. Offer a first slice with a price and a date, not a programme.
We do this work often, including finishing projects other teams left behind. An audit is short and priced in advance, and it ends with a recommendation you can take anywhere. Tell us what you are running.