Cloud7 min read
A practical guide to legacy application modernization
Rehost, refactor or rebuild? This guide explains the main modernisation strategies, how the strangler fig pattern reduces risk, and how to decide what to do with each part of a legacy system.
By INFIDEC Engineering Team

Why modernise, and why it is hard
Legacy systems usually still work, which is exactly what makes them hard to replace. They encode years of business rules, often undocumented, and the people who wrote them may have left. The reasons to modernise tend to accumulate quietly: unsupported runtimes and security exposure, slow and risky releases, rising hosting and licence costs, difficulty hiring for old technology, and an inability to integrate with newer systems.
The biggest risk is not technical. It is the temptation to rewrite everything at once, which delays all value until the end and assumes the new system will match behaviour nobody has fully documented. A practical approach modernises incrementally and chooses a different strategy for different parts of the system.
The main strategies
Cloud providers describe migration options in slightly different ways, often called the 6 Rs or 7 Rs. For application modernisation, these are the options that matter most.
- Retire: switch off functionality nobody uses. Usage analysis often finds more of this than expected, and it is the cheapest modernisation there is.
- Retain: leave stable, low-change components alone for now and revisit later.
- Rehost: move the application to new infrastructure, such as cloud virtual machines, with minimal code change. It is fast and lowers data centre risk but does not fix the architecture.
- Replatform: make targeted changes to use managed services, such as moving to a managed database or containerising the application, without redesigning it.
- Refactor: restructure code to improve maintainability, scalability or deployability while preserving behaviour, for example breaking out services or upgrading frameworks.
- Rebuild or replace: rewrite a component from scratch, or replace it with a SaaS product when the capability is not a differentiator.
How to choose for each component
Rarely does one strategy suit a whole system. Map the application into capabilities and assess each one on business value, rate of change, technical condition and risk.
- High value and frequently changing: strong candidates for refactoring or rebuilding, because faster change pays back quickly.
- High value and stable: often best rehosted or replatformed, then left alone.
- Low value and commodity, such as basic HR or invoicing: consider replacing with an off-the-shelf product.
- Low value and little used: retire.
The strangler fig pattern
The strangler fig pattern, named by Martin Fowler, replaces a legacy system gradually. A routing layer, such as an API gateway or reverse proxy, sits in front of the old application. New or rebuilt capabilities are deployed as separate services, and the router sends the relevant requests to them while everything else still goes to the legacy system. Over time, more routes move across until the old system can be switched off.
Because each step is small, each step can be tested, released and rolled back independently, and the business sees value long before the migration ends. The hardest part is usually data. New services often need to read or write data that the legacy system still owns, so plan for synchronisation, such as change data capture or events, and use an anti-corruption layer to translate between the legacy data model and the new one so old concepts do not leak into the new design.
Reduce risk at every step
Modernisation goes wrong when behaviour changes unexpectedly. These practices make that much less likely.
- Write characterisation tests that capture what the legacy system actually does today, including the odd behaviour users depend on.
- Add monitoring and logging to the legacy system before changing it, so you can compare old and new behaviour.
- Run new components in shadow mode or parallel run, processing real traffic and comparing results before they take over.
- Use feature flags and gradual rollouts to move a small share of users first.
- Reconcile migrated data against the source with automated checks, not spot checks.
Measuring progress
Track outcomes rather than lines of code migrated. Useful measures include deployment frequency and lead time for changes, incident and rollback rates, infrastructure and licence cost, and the share of traffic or functionality served by the new platform.
Plan the team as carefully as the architecture. Pair engineers who know the legacy system with those building the new one, so knowledge of hidden rules transfers rather than being rediscovered in production. Keep business stakeholders close as well: they are often the only people who can say whether an odd legacy behaviour is a bug to fix or a rule to preserve.
Agree upfront what done looks like, including when the legacy system will be decommissioned. Migrations that never finish leave you running and paying for two systems, which is often worse than where you started.



