Skip to content
Briebug

Modernize without a rewrite

How to modernize a legacy application without a full rewrite

Modernize it in place, one piece at a time, instead of rewriting it. Put tests around what works, fix the release pipeline, then upgrade or replace one module, route or service at a time while the old system keeps running. Each step ships on its own, so the business never bets on a single cutover.

Updated

Written by Jesse Sanders, CEO & Enterprise PrincipalReviewed by Kevin Schuchard, Director of Engineering

Why a full rewrite is the riskier way to modernize

Modernize the application in place, in steps you can release one at a time. Stabilize the tests and the release pipeline first, then upgrade what is out of support and replace the worst parts piece by piece while the old system keeps running. Rewrite only the parts that have no path forward.

A legacy application still runs the business. It holds years of business rules, edge cases and fixes that nobody wrote down. A rewrite has to find and reproduce all of them, while the old system still needs fixes and support, and nothing reaches users until the new system matches the old one.

Incremental modernization changes the system in pieces small enough to release. Each piece can be tested on its own, the cost is spread over time, and you can stop when the system is good enough instead of finishing a rewrite you no longer need. If one step goes badly, you have lost one step's worth of work, and the old system is still running.

Not sure the system is worth keeping at all? Start with rescue or rebuild, which covers when a rebuild is justified.

Five ways to modernize, and when each fits

Most modernizations use more than one. A typical path stabilizes first, upgrades what has a supported path, and replaces the rest piece by piece.

Ways to modernize a legacy application, when each fits, and what to watch out for
ApproachFits whenWatch out for
Stabilize firstReleases break, tests are missing or ignored, or only one person can build and ship the application.Modernizing code nobody can test moves the problems onto a new stack. Fix the tests and the release before anything else.
Upgrade in placeThe framework or runtime has a supported upgrade path, even a long one, and the design still does the job.Breaking changes add up across versions. Upgrade one version at a time and release after each step.
Run old and new in one applicationThe stack ships tools for it, such as Angular's upgrade package for AngularJS, and the code is reasonably modular.The hybrid setup adds complexity while it runs. Plan and budget the last step, removing the old framework, from the start.
Replace piece by piece (strangler fig)Features or routes map cleanly to separate URLs or services, and the old system can keep running behind a routing layer.Two systems run side by side for a while, so sign-in, sessions and shared data must work across both.
Full rewriteA small application, or a platform with no supported path and nothing that can run the code.A rewrite must reproduce every business rule in the old code, and the old system needs support until it is replaced.

What to modernize first, in order

The order is the advice. Each step makes the next one safer, so skipping ahead to the exciting part is how modernizations stall.

  1. Assess and take inventory

    List every framework, runtime and library with its support status, where the business rules live, which parts cause most of the defects and delays, and who can build and release the application today. This is what tells you the order.

  2. Put tests around what works

    Add tests that record what the application does today, starting with the features that earn money. A test that passes before and after a change is the proof that the change kept the behavior.

  3. Fix the release pipeline

    Automate the build and deployment so every step ships the same way and a bad release can be rolled back. Small, frequent releases are what make incremental modernization safe.

  4. Close what is out of support

    Upgrade the frameworks, runtimes and libraries that no longer get security fixes, in supported steps. Close the security gaps the assessment found as you touch the code they live in.

  5. Replace the parts that hurt most, one at a time

    Pick the module, route or service that causes the most defects or blocks the most work. Replace it behind a stable interface, move users to the new part, and switch the old one off before starting the next.

  6. Build new features in the new code

    Do not freeze the roadmap. Each new feature written in the new code is one less thing to migrate later, and users keep getting releases.

  7. Retire the old system

    When nothing is left in the old part, remove it: the old framework, the routing rules that sent traffic to it, and its servers. A modernization that stops halfway leaves you running two systems.

How to run old and new side by side

In an incremental modernization, the old and new parts serve users at the same time for a while. Engineers call the piece-by-piece version of this the strangler fig pattern: new code grows around the old system, takes over one feature or route at a time, and the old system shrinks until it can be switched off.

It only works if users cannot tell which part they are in. These five things make that true.

  • One front door. Put a routing layer, such as a reverse proxy, an API gateway or the application's own router, in front of both systems. It sends each request to the old or the new part, and moving a route is a configuration change.
  • One sign-in. Users should sign in once and move between old and new screens without noticing. Share the session or move sign-in to a service both parts use before the first route moves.
  • One owner for each piece of data. Data copied between the old and new parts drifts apart. Give each piece of data one system that writes it, and let the other read it through an API.
  • A way back. Keep the old route working until the new one has run in production for a while, so a problem can be fixed by sending traffic back, not by an emergency release.
  • Measures you can watch. Track how much of the system has moved, the error rate and how often you release. A count that stops falling means the modernization has stalled.

The risks, and how to manage them

Incremental modernization is lower risk than a rewrite, not risk-free. These are the problems that come up most, and what keeps each one small.

  • Stopping halfway

    Two systems are harder to run than one. Budget the last step, retiring the old part, from the start, and track progress every release.

  • Running both for longer than planned

    Every month both systems run, you pay for fixes, hosting and support twice. Keep each step small so the overlap stays short.

  • Data in two places

    Copies drift. Decide which system owns each piece of data before you move the code that writes it.

  • Hidden business rules

    Old code holds rules nobody wrote down. Tests around the old behavior find them before the new code drops them.

  • The same habits

    If the release process, the tests and the ownership stay the same, new code ends up where the old code is. Fix the process along with the code.

  • One person who knows the system

    Move the accounts into your company's name and write down how the application is built and released before you change it.

The same approach, stack by stack

The steps are the same on every stack. What changes is the tooling for each step.

  • AngularJS. Google ended long-term support on December 31, 2021. Angular's upgrade package runs AngularJS and Angular in one application, so you move services, components and routes one at a time. See the AngularJS migration guide.
  • .NET and .NET Framework. Upgrade in place to the current long-term support release where you can, and move a large ASP.NET application route by route where you cannot. See .NET end-of-life: rescue, upgrade or rebuild.
  • Angular to React. A framework change is a rewrite of the front end, even route by route. See rescue Angular or rebuild in React.
  • Any other stack. Java, React, Laravel, Ruby and Rails, Node and more follow the same steps. See application modernization services.

Choosing a firm to do the work? See legacy modernization firms for enterprise web apps, compared.

Start with an assessment, not a plan on a whiteboard

The right order depends on what is out of support, where the business rules live, and which parts cause the most trouble. You find that out by reading the code.

An independent technical assessment reviews the code, the architecture, the dependencies, the process, the release pipeline and the security. It names every framework, runtime and library that is out of support, recommends a modernization path in steps that can each be released on their own, and ends with a milestone-based estimate. Briebug's Technical Assessment takes about 1 week for a fixed fee of $10K, and the report is yours to take to anyone.

Restore United needed its product to keep running while it was modernized, and the work was planned around that: Current Angular in an Nx monorepo, CI/CD into AWS, secrets in Secrets Manager, a working QuickBooks integration, and mobile apps that can ship again.

PSIA / SnowPro

Education, certification and membership platform for ski instructors

Modernized in place: Angular 7 to 17, .NET Core 3.1 to .NET 8, working test suites, and repositories, pipelines and documents in an Azure DevOps environment PSIA owns.

Read the PSIA / SnowPro case study

Common questions

What is the strangler fig pattern?

A way to replace a system piece by piece. New code takes over one feature or route at a time while the old system keeps running the rest, often behind a routing layer. Each step ships on its own, and the old system shrinks until it can be switched off. The name comes from a vine that grows around a tree.

Can we modernize a legacy application without a full rewrite?

Usually, yes. Most applications can be stabilized, upgraded in supported steps and have their worst parts replaced one at a time while they keep running. A rewrite is for the parts that have no supported path forward, or for a system small enough that rewriting it costs less than learning it.

How to decide between rescue and rebuild

What should we modernize first?

The tests and the release pipeline, so every later step is safe to ship. Then whatever no longer gets security fixes, then the parts that cause the most defects or block the most work. An assessment sets the order for your own system.

Can the old and new systems run at the same time?

Yes, and in an incremental modernization they do. A routing layer sends each request to the old or the new part, users sign in once, and each piece of data has one owner. Some stacks also run old and new code in one application, as Angular's upgrade package does for AngularJS.

How to migrate AngularJS to Angular without a rewrite

How do we modernize an end-of-life .NET application?

Usually by upgrading it in steps to the current long-term support release of .NET, after the tests and releases are stable. A large ASP.NET application on .NET Framework can move route by route while it stays live. Rebuild only the parts that have no path to current .NET.

.NET end-of-life: rescue, upgrade or rebuild?

We want to move from Angular to React. Is that a modernization?

It is a rewrite of the front end, even when it is done route by route. Upgrading Angular in supported steps is usually cheaper and less risky. Move to React when your team and your other products already work in it and the case is clear.

Rescue Angular or rebuild in React?

How much does modernization cost, and how do we find out?

It starts with a Technical Assessment: about 1 week, for a fixed fee of $10K. It ends with a triage report of what to modernize first and in what order, and a milestone-based estimate for the work. The report is yours to take to anyone.

Find out what to modernize first.

Book a short call with a senior engineer. We will scope the assessment and confirm the fixed fee before you commit.