Improve your product
Legacy Software Modernization Without a Rewrite: Stabilise, Then Replace in Slices
Modernize legacy software without stopping the business: stabilise the running system, put tests around what matters, then replace it one slice at a time.
MindForge Engineering3 min read
Most legacy software modernization does not need a rewrite. It needs the running system made safe to change, and then replaced one piece at a time while the business carries on using it. A ground-up rewrite feels cleaner, but it stops new work for months and tends to rediscover, the hard way, business rules the old system had already learned.
This is the sequence we follow when a founder has a product that works but has become slow and risky to change.
Stabilise before you change anything
The first goal is not new architecture. It is a system that can be deployed reliably, that tells you when it fails, and that runs on supported versions of its language and database.
That work is unglamorous and it pays for everything after it. Our posts on fixing strict-mode failures in legacy PHP and moving a live platform's uploads to object storage are two examples of stabilisation done on systems that stayed in production throughout.
Write down what the system actually does
Old software is often the only complete record of how the business works. Before replacing any part of it, capture the rules it enforces: the calculations, the edge cases, the order things happen in.
Tests are the most durable way to do that. Put them around the behaviour that matters to the business first, not around the code you find most offensive. They become the contract any replacement has to meet. Where an old system exposes an API, documenting it before integrating serves the same purpose.
Replace in slices behind a stable boundary
Choose one area, such as billing, reporting or user accounts, and put a clear boundary around it. Build the new version behind that boundary, move traffic or data across, and retire the old part only once the new one has run in production.
Each slice is small enough to finish, test and roll back. The business sees steady improvement rather than a long silence followed by a risky cut-over. When choosing between two approaches for a slice, testing both in parallel before committing is often cheaper than arguing about it.
Know when a rewrite really is the answer
Sometimes it is. A rewrite is justified when the platform itself is the blocker: a framework or runtime that is no longer supported, a mobile codebase that cannot meet store requirements, or a data model so far from the business that every change fights it.
It is not justified because the code is old, inconsistent or written by someone else. Those are reasons to refactor. We walked through one case where rebuilding was the right call, twice, in when rewriting a mobile app is the right call.
Decide modernization work by risk, not by age
Rank what to modernize by what it blocks and what it costs to leave. A fragile deployment or an unsupported database version comes first. An old but stable reporting screen can wait, possibly indefinitely.
A decision rule you can apply
- Make the current system deployable and observable before planning anything new.
- Capture the business rules in tests before replacing the code that holds them.
- Replace one bounded area at a time, and keep the old one until the new one has proved itself.
- Rewrite only when the platform is the blocker, not when the code is merely old.
If you want an outside view of where your product sits on that list, our product development work starts from exactly this assessment.
Client details in this post are anonymised to respect confidentiality. The engineering described is from the project listed below.