Skip to content

Field Guide

How to replace a system that still works

Practical pages on the one project every engineering team eventually faces: deciding whether the old system has to go, and getting from Gen 1 to Gen 2 without stopping the business in between.

Slide: the route from Gen 1 to Gen 2 in five stations: decide, pick a pattern, move the data, cut over, switch Gen 1 off.
Slide: four options around your system: leave it alone, refactor in place, replace it piece by piece, rewrite it. Part 1 Rewrite vs refactor: the four real options The argument is usually framed as two choices. There are four, and the two that get left out are the ones that are right most often. Read the guide Slide: the seven migration strategies in a row, retire, retain, rehost, relocate, repurchase, replatform and refactor, from least change to most. Part 2 The 7 Rs of migration: retire, retain, rehost and the rest Before arguing about rewriting, sort every system into one of seven answers. Most of them are not rewrites, and the cheapest one is switching something off. Read the guide Slide: record what Gen 1 really does, bugs included, as characterization tests, then Gen 2 must pass the same tests. The running system is the specification. Part 3 Characterization tests: pin down what Gen 1 really does Nobody can say exactly what Gen 1 does. Characterization tests find out by asking it, and then hold Gen 2 to the answers. Read the guide Slide: a single estimate date crossed out, replaced by a range bar that includes the Gen 1 team, the overlap and the long tail. Part 4 Estimating a rewrite: a range, not a date The honest answer to how long a rewrite takes is a range with its assumptions attached. A single date is a promise nobody can keep. Read the guide Slide: three stages behind a router: start with everything on Gen 1, move slice by slice, then switch Gen 1 off. Part 5 The strangler fig pattern Grow the new system around the old one, move one slice of work at a time, and switch the old system off when it has nothing left to do. Read the guide Slide: one large monolith block splitting into a few small services, with an arrow going back for teams that regroup them. Part 6 Monolith to microservices, and back again Splitting a monolith is a migration like any other, with one extra risk: the destination can be worse than where you started. Read the guide Slide: a server box moved unchanged from a data center to a cloud, then modernized later, one part at a time. Part 7 Lift and shift: moving first, modernizing later The least exciting migration is often the right first one: move the system as it is, prove it runs, and decide about the design with less pressure. Read the guide Slide: a small first system beside a second system buried under plugins, a rules engine, a new UI and a new data model. Part 8 The second-system effect The first system was small because it had to be. The second one is where every postponed idea shows up at once, and that is what sinks it. Read the guide Slide: callers reach a seam that switches between the old component and the new one, while releases from trunk never stop. Part 9 Branch by abstraction Put a seam around the component you want to replace, build the new one behind the seam, and keep releasing from trunk the whole time. Read the guide Slide: Gen 2, which speaks only its own model, and Gen 1, the legacy model, with an anti-corruption layer between them that translates both ways. Part 10 The anti-corruption layer: keeping Gen 1's model out of Gen 2 Gen 2 has to talk to Gen 1 for as long as both are running. Without a boundary, every one of those calls drags a little of the old design into the new system. Read the guide Slide: the same requests go to Gen 1 and Gen 2, the answers are compared, and every difference is explained. Part 11 Parallel run: trust Gen 1 until the differences are explained Give both systems the same inputs, compare what comes out, and keep using the old answer until every difference has an explanation. Read the guide Slide: live requests are mirrored. Gen 1 answers the user, Gen 2 gets a copy, its answer is discarded and it causes no real side effects. Part 12 Shadow traffic: show Gen 2 real requests before it answers any Send Gen 2 a copy of every live request, throw its answers away or compare them, and make sure it cannot touch anything real while it learns. Read the guide Slide: the application writes to both Gen 1 data and Gen 2 data, with a backfill of old rows and a verify step. Part 13 Dual write and data migration Moving the code is the easy half. The data has to move while both systems are live, and at every moment exactly one of them has to be right. Read the guide Slide: expand, add the new shape beside the old; migrate, move every reader and writer; contract, remove the old shape. Gen 1 and Gen 2 share the database the whole time. Part 14 Expand and contract: changing a schema both generations use During a migration the database is the one thing both generations share. Expand and contract is how its shape changes underneath them without a single breaking release. Read the guide Slide: three jobs for data tools: copy once, replicate continuously and change a live table, each with a named tool. Part 15 Data migration tools: copy, replicate or change in place Pick the tool by the job: moving data once, keeping two stores in step, or changing a live table without blocking it. Read the guide Slide: a track switch from Gen 1 to Gen 2 with rollback, above six steps from the freeze to the first 72 hours. Part 16 The cutover The moment work stops going to Gen 1 and starts going to Gen 2 is the riskiest step in the project. It is also the one that gets planned last, with whatever schedule is left. Read the guide Slide: a feature flag sends users to Gen 1's answer while Gen 2 runs in the dark, then rolls Gen 2 out at 1%, 5% and 100%. Flip it forward, flip it back. Part 17 Feature flags and dark launches: cutover as a switch, not an event The safest cutover is one where Gen 2 is already running in production, already under real load, and one switch away from being the system users see. Read the guide Slide: everyone moves from Gen 1 to Gen 2 at one moment, which demands a rehearsal, a rollback plan, a freeze and a staffed first 72 hours. Part 18 Big-bang cutover: when everyone has to move at once Sometimes every user really does have to move from Gen 1 to Gen 2 in the same night. That can be the right call. It is never the easy one. Read the guide Slide: phone, laptop and partner clients call /v1, Gen 1's contract with a sunset date, and /v2, Gen 2's contract. Clients change on their schedule, not yours. Part 19 Versioning an API when Gen 2 changes the contract Gen 2 can change everything behind the API. The API itself is a promise to people you do not control, and it changes on their schedule, not yours. Read the guide Slide: Gen 1 and Gen 2 on a timeline, with the overlap where both are paid for highlighted. Part 20 Running two systems at once From the first day of Gen 2 work to the day Gen 1 is switched off, the organization pays for two systems. Most plans budget for the build and forget the overlap. Read the guide Slide: an old server still running beside a checklist that ends with switching it off. Part 21 Killing Gen 1 The project is declared done at cutover and the team moves on. Years later the old system is still running, for one customer, one report and a nightly job nobody remembers. Read the guide Slide: a phone update replacing the old app, with checks for parity, staged rollout and a way back. Part 22 Rewriting a mobile app: your users already have Gen 1 A web rewrite can hide behind a router. A mobile rewrite arrives as an update on someone's phone, and you cannot take it back quickly. Read the guide Slide: code quality crossed out, and the three things a CFO buys: cost, risk and options. Part 23 Selling a rewrite (and saying no to one) A CFO does not buy code quality. A CFO buys lower cost, lower risk and more options. The same test that makes a rewrite fundable is the one that lets a CTO turn one down. Read the guide Slide: a generated first version, then four steps: audit, test harness first, keep or refactor or regenerate, add what is missing. Part 24 Gen 2 of AI-written code The first version was generated in weeks and it works. Now somebody has to maintain, extend and secure it, and there is no author to ask why. Read the guide

The short version

Decide before you design

Most failed replacements were never really decided. Somebody proposed a new platform, nobody objected, and the project existed. Start by saying in one sentence what is wrong with the system today and how you will know it is fixed. If you cannot, you are not ready to choose an approach.

Prefer the reversible option

Leaving a system alone and refactoring it can both be undone next quarter. Replacing it slice by slice can be paused. A from-scratch rewrite is the only option that pays nothing back until the day it is finished. When two options look equally good, take the one you can stop.

Keep shipping

The common thread in the case files is not talent or budget. The replacements that worked kept releasing to real users the whole way through. The ones that failed went quiet for years and came back to a market that had moved.

Plan the ending

Switching off Gen 1 is the part every plan leaves out. Until that happens you are paying for two systems, and the old one is still the one people trust. Put a date on it at the start, and schedule the hardest migrations early instead of last.

Not sure which option you are looking at?

Sixteen questions about your system, and a recommendation with its reasoning.

Should we rewrite it?