How to modernise a legacy application without a rewrite?

How to modernise a legacy application without a rewrite?
The application is ten years old. It takes the orders, sends the invoices and holds the customer records, and it has started to cost more each year: changes take longer, fewer people want to work on it, and a version it depends on has gone out of support. You ask what to do, and most of the answers you get are the same: rebuild it.
Sometimes that is right. More often, the system can be brought up to date in place, one part at a time, while it keeps doing its job. This article describes that route: the order of the work, what the business sees at each step, and the signs that a rewrite is the better answer after all.
Why a complete rewrite is harder than it looks
A rewrite is attractive because the estimate is made against a clean page. The difficulties come from the old system, not the new one.
  • The old system is the only full specification. Ten years of rules are in it: the discount for one customer group, the exception for one country, the fix for a problem everyone has forgotten. Few of them are written down anywhere else. The new system has to find each one again, usually when a customer complains.
  • You pay for two systems. The old one must keep running until the new one is ready, with its hosting, its fixes and its urgent changes.
  • The business doesn't wait. Either new features stop for the length of the rewrite, or they are built twice.
  • The value arrives at the end. Nothing is better for the business until the day of the switch, and that day carries the most risk in the whole project.
  • The risk you wanted to remove is still there. If the old system has no backups and an unsupported version today, it still has them a year into the rewrite.
None of this is new. Joel Spolsky's essay on the Netscape rewrite, Things You Should Never Do, was written in 2000 and is still quoted for the same reasons.
The route, step by step
Legacy application modernisation (or modernization, in American spelling) has a usual order. Each step makes the next one safer, and each one ends with a system that is live and working.
1. Find out what you have
Start with a written picture of the system: where it runs, which versions it uses, what it connects to, who has access, and which risks could hurt the business now. Without it, the plan is made from opinions. A technical audit produces that picture.
What the business sees: a report, with the risks in priority order. Nothing in the system changes.
2. Make it safe to change
Before improving anything, make sure a mistake can be undone.
  • Backups that run automatically, and a restore that has been tested.
  • All the code in Git, matching what runs in production.
  • A staging copy of the system where changes are tried first.
  • A release that follows written or automated steps, and a way to put the previous version back.
  • Monitoring that tells a person when something fails.
On one inherited Laravel platform this step came before everything else: backups first, then secrets moved out of the code, then the security gaps closed.
What the business sees: almost nothing, and that is the point. The most serious risks are gone, and the features are the same.
3. Upgrade the foundations
Next come the versions underneath the application: the operating system, PHP, the framework, the database. Each upgrade is done one step at a time, tested on a copy before it touches production. For the riskiest ones, the whole upgrade is rehearsed on a clone of the server first.
This step often pays for part of itself. On one project, moving a database from MySQL 5.7 to 8.0 removed about $900 a month in extended-support fees from the AWS bill.
What the business sees: short planned maintenance windows, security fixes arriving again, and sometimes a smaller hosting bill.
4. Put tests around the part you are about to change
An old system rarely has automated tests, and writing them for everything would take months. Write them for the module you are going to change next. The tests record what the code does today, so that a change in behaviour is noticed before customers notice it.
What the business sees: fewer surprises after releases.
5. Improve or replace one component at a time
Now the parts that hold the business back can be changed, starting with the one that hurts most. The old and new parts run side by side, and each release moves a little more of the work to the new one. Four examples from our own projects:
What the business sees: improvements arriving in the order it asked for them, every few weeks.
6. Keep it current
A system becomes "legacy" when nobody updates it for a few years. After the catching-up is done, regular maintenance keeps it from happening again.
Four rules that keep the business running
  • Every step is released. Work that sits unreleased for months is a small rewrite.
  • Every release can be undone.
  • New features are not frozen. They slow down in the area being changed and carry on elsewhere.
  • You can stop after any step. The system is better than it was, and nothing is half-finished.
How to tell that it is working
Ask for a few plain measures at the start, and again every quarter:
  • how often a release goes out, and how many had to be undone;
  • how long a typical small change takes from request to live;
  • how many incidents customers noticed;
  • which versions are in use, and the date each one stops being supported;
  • the monthly hosting bill.
If these don't move after two or three quarters, the plan needs another look.
When a rewrite really is the answer
The step-by-step route is a default, and there are cases where it is the wrong one.
  • The technology has no path forward. There is no supported version to upgrade to, and almost nobody left who works with it.
  • The business has changed more than the system can. The software describes a way of working that the company no longer uses, down to the structure of its data.
  • The system is small. If it can be rebuilt in a few weeks, understanding the old code may cost more than replacing it.
  • A ready-made product now does the job. Then the question is replacement, not a rewrite, and the work is moving the data and the processes.
  • The audit says so, with evidence. The cost of each route has been estimated on the same basis, and the rewrite is cheaper over the years you plan to use the system.
Even then, replace the system in parts where you can, with the old one still running, so that there is no single day on which everything changes.
Questions to ask before you choose
  1. What will be better for the business after three months, and after six?
  2. What keeps the current system safe while the work goes on?
  3. Can we stop halfway and still have something that works?
  4. How will we know, each quarter, that it is working?
  5. If you recommend a rewrite, what did you find in the existing system that rules out improving it?
Short answers
Can a legacy application be modernised without downtime?
Mostly, yes. Code changes are released without interruption. Upgrades of the server or the database need a short planned window, which can be placed at the quietest hour and rehearsed beforehand.
Is it cheaper than a rewrite?
Not always in total. The difference is in how the money is spent: in small steps, each with a result you can use, and with the option to stop. A rewrite asks for most of the budget before it returns anything.
How long does it take?
There is no single deadline, because the work is done in phases. Making the system safe comes first and is the shortest part. How far to go after that is your decision, taken one phase at a time.
Where we fit
This is the work we do: modernisation without a complete rewrite for existing PHP, Laravel and Symfony applications, including older custom PHP systems, followed by ongoing maintenance so the system stays current.
The first step is the same either way. A System Risk Check gives you the written picture from step 1 at a fixed price, including our view on whether your system can be improved in place. The report is yours to use with us, with your own team or with another supplier.
system risk check

Not sure what state your application is in?

A System Risk Check is a fixed-price technical audit of your application, database and infrastructure, with a written, prioritised report. The report is yours, whatever you decide next.