Legacy Software: Improve It, Rebuild It, or Replace It?
Old software that does its job is not a problem in itself. Plenty of businesses run reliable systems written ten or more years ago, some of them on old platform versions such as PHP 5.x, and replacing them would cost money and add risk without adding value. The real question is not how old the system is, but whether it blocks something the business needs, exposes it to a real security risk, depends on something that is actually going away, or costs more to keep than to change. If none of that applies, keep it and improve it where it hurts. If some of it does, the best path is usually still gradual: change one part at a time rather than everything at once.
Why "it's old" is not a reason
A system that has run a business for years contains years of decisions: tax rules, discounts for particular customers, exceptions someone asked for long ago and everyone has since forgotten. Joel Spolsky made this point in a well-known essay about Netscape's decision to rewrite its browser from scratch, which he called "the single worst strategic mistake that any software company can make". Code that looks strange is often strange for a reason – in his words, "those are bug fixes". He also observed that "it's harder to read code than to write it", which explains why developers so often prefer to start over.
Even migration guidance from a large cloud provider treats keeping a system as a legitimate decision. AWS's list of migration strategies includes "retain", for example when there is no business value in migrating an application, such as one with only a few internal users.
Real reasons to act
- It blocks the business. Something you need – a new product type, a new sales channel, a connection to a courier or accounting system – is impossible or disproportionately expensive to add.
- A real security exposure. A known vulnerability that affects the parts of the system you actually use, in the way they are actually exposed – not a theoretical one.
- A dependency you rely on is going away. Your host is dropping the platform version, a payment or courier provider is retiring the interface your system uses, or the server can no longer be kept running.
- Nobody can maintain it. The source code is missing, or the only person who understood it has left. AWS lists "a legacy application that nobody knows how to maintain, or the source code is unavailable" among the typical reasons to re-architect.
- Keeping it costs more than changing it. Hours of manual workarounds every week, repeated outages, or licence fees that exceed what a change would cost over a reasonable period.
If you cannot name one of these concretely, you probably don't have a reason yet.
Old versions and security: the facts, without alarm
It is fair to know what "unsupported" means. The PHP project, for example, fully supports each release branch for two years, then provides fixes for critical security issues only for two more years; after that the branch reaches end of life and is no longer supported. PHP 5.6 reached end of life on 31 December 2018, so PHP 5.x receives no security fixes from the PHP project.
What that means for your system depends on exposure. An internal tool used by a few colleagues behind a login and a restricted network is in a very different position from a public online shop with forms and payments. The useful questions are concrete: which parts can be reached from the internet, what data they handle, and whether any known vulnerability applies to the features you actually use.
When there is a real exposure, a rewrite is not the only answer. OWASP describes "virtual patching" as a security policy enforcement layer that detects and blocks exploitation attempts against a known vulnerability without changing the vulnerable code. It presents this as an interim measure that runs alongside a proper fix rather than replacing it, but it buys time to plan calmly. Other practical steps: restrict access to admin areas, switch off features nobody uses, keep tested backups and watch the logs.
Improve, rebuild or replace: how they compare
| Improve | Rebuild | Replace | |
|---|---|---|---|
| What it means | Fix specific problems in the existing system and add what is missing | Write new software for the same job, ideally piece by piece | Move to a ready-made product or online service |
| Fits when | The core works and the problems are specific | The business logic is valuable and specific, but the codebase blocks change | Your process is fairly standard and a product covers it |
| Main risk | Some underlying limits remain | Losing hidden rules; running two systems for a while; overruns | Bending your process to fit the tool; data migration; ongoing fees |
| What you keep | Everything that works | Your rules, rewritten | Your data, if it migrates cleanly |
Replacing is not free of work either. AWS notes that after buying a replacement you still need to train your team and users, migrate your data, integrate the new application with your other systems and configure the network around it. Our article on comparing the total costs of custom software and SaaS goes through those numbers.
What incremental improvement looks like
- Fix the bottleneck, not the whole system. Search on gega.bg, our product search engine with around 2.7 million products, was sped up by moving from LIKE queries to a FULLTEXT index on InnoDB – a targeted change, not a rebuild.
- Build new things beside the old system. A customer portal, a mobile app or a partner connection can talk to the old system through a small, well-defined API layer, without touching its core.
- Write down the business rules hidden in the code, and add tests around the critical calculations before anyone changes them.
- Change versions when there is a reason. If the host drops the version you run, a provider requires something newer or a feature you need depends on it, treat the move as its own small project and test it properly.
- Remove what nobody uses. Less code means fewer things to secure and maintain.
If you rebuild, do it gradually
Martin Fowler's "Strangler Fig" pattern describes the safer way to replace a system. It starts with small additions, often new features, built on top of yet separate from the legacy code base, and then moves pieces of behaviour from the old system into the new one. Fowler writes that the simple-sounding plan of replacing everything in one go has gone "down in flames most of the time", while small components carry less risk and let the business benefit earlier. He is honest about the cost too: you need temporary connections between old and new that disappear once the move is finished.
In practice: pick one module – reports, the customer area, invoicing – build it new, run it beside the old one, switch over when it has proved itself, and only then take the next one. At every step you have a working system.
Questions to decide with
- What exactly can't we do today, and what does that cost us per month or per year?
- Is there a known security issue that affects us, and can it be reduced without a rewrite?
- Is any dependency being withdrawn – hosting, a provider's interface, the server – and when?
- Do we have the source code and someone who understands it?
- Which business rules live only in the code?
- Would improving one part solve the actual problem?
- What would replacement really cost: licences or development, data migration, training, integrations and running two systems side by side for a while?
The same thinking applies to websites; see website redesign or small improvements: how to decide.
If you have an older system and are unsure what to do with it, we can review the code and how your team uses it and tell you plainly whether targeted improvements are enough or where a gradual rebuild would pay off. Read more about our web-based software development or contact us to describe your system.