White Prompt
AINov 24, 2026 · 7 min read

How Far Back Is Your Legacy System?

By Martin Bonafede

Where the path starts depends on the answer. How you prove each step does not.

ec69fc107a2bda741f31cec924599685.webp

There is a file like this in almost every old system I have opened.

' Billing.bas · last change 2009-03-14' DO NOT MODIFYPublic Function CalcInvoice(ByVal id As Long) As Currency    On Error Resume Next    Dim rs As ADODB.Recordset    Set rs = Db.Execute("SELECT * FROM INV WHERE ID=" & id)    CalcInvoice = rs!Amount * 1.21 + LegacyFix(rs!Code)    ' TODO: remove after migration (2011)End Function

A warning in capitals. A date from another decade. A fix nobody can explain, and a promise to remove it after a migration that never happened. It still runs every day, and invoices go out because of it.

Nobody on the team is afraid of the language. They are afraid of the behavior: the rounding one customer depends on, the branch that only runs at year end, whatever LegacyFix does. None of it is written down.

That fear is rational, and it is the real subject of any modernization.

The old code is not the risk. The risk is everything it does that nobody remembers asking for.

A path, not a leap

Modernizing a system means changing up to three things: the language it is written in, the infrastructure it runs on, and the architecture that organizes it.

The tempting plan changes all three at once. New stack, cloud, a few dozen microservices, one cutover weekend.

I picture it as two mountains. Your system climbed the first one and took the business to the top. Then a taller one appeared next to it, with cloud, automation and AI on its slopes. The big rewrite is an attempt to jump from one summit to the other.

d15bd5fef028701a1a6bcb1a5ee7b67e.gif

Handing the jump to an AI that translates the code line by line does not change the physics. You get the old design in a new language, and the same single cutover.

Both plans share one flaw: they start building before anyone knows what the old system really does.

The alternative is a path. Down from where you are and up the other side, one module at a time, with the old system running until each piece has been replaced. And the goal is not to stand on the new summit next quarter. There will always be another mountain. The goal is to be moving again.

So the useful question is not which architecture to choose. It is how you prove, piece by piece, that the new system does what the old one did.

Legacy is a distance, not a type

Legacy is not a matter of age. It is any system that keeps the business from moving at today’s speed. What changes from one to the next is how far back it is, and that decides where the path starts.

602619eaf962c5e1ce931f7d9c099d56.gif

Furthest back: the desktop app wired to the database. VB6, Delphi. The rules live inside form events and stored procedures, and it only scales with a bigger server. Nothing sits between the screen and the data, so there is nothing to intercept. We watch the edges instead: what gets written to the database, which files and reports come out. The first move is usually to pull the rules out behind an API and peel modules off one by one.

Closer: the web app tied to its servers. .NET Framework, ASP.NET Web Forms, older Java. Here every request can be recorded and replayed, which is a gift. The path usually leads to a current runtime, containers and the cloud, without rewriting what already works.

Closer still: the outdated frontend. AngularJS, jQuery. The backend holds, the screens do not. It moves screen by screen, with both versions live.

Almost here: the modern stack that aged. .NET Core, Node, Spring. The technology is fine and the design is not: tangled modules, few tests, manual deploys. Often nothing needs migrating. It needs boundaries, tests and a pipeline.

And the common case: several distances at once. An old core nobody can touch, with newer services orbiting it. The first job is a layer that isolates the core, so it can be absorbed gradually.

One caveat: you cannot tell the distance from the outside. A system on a current framework can be further back than a well kept Delphi app.

Where you start depends on the system. What you have to prove at every step does not.

Read it before you touch it

Whatever the distance, every module goes through the same four moves. The first is to read.

AI agents and engineers go through everything that exists: source code, database, infrastructure, documentation, the ticket history, and the people who operate the system. What comes out is a map of modules and dependencies, and a catalog of business rules that includes the ones nobody documented.

It has a limit. Code tells you what the system can do, not what it actually does on a Tuesday. Some of that catalog is dead paths. And none of it includes the spreadsheet somebody fills in by hand before the monthly close.

Let the old system show you what it does

So before replacing a module, we put the old one to work.

0b6c33ac43753562dca050b971ae7fc5.gif

Agents take the rule catalog and turn it into scenarios: every branch, every customer type, the boundary values, the dates that tend to break things. They run them against a copy of the old module, next to real inputs captured from production, and record every answer. Not to judge it. To pin it down.

This runs for a while, and the while is not arbitrary: long enough to see the module’s real rhythm. A billing run. A month end. The thing that only happens in December.

Every answer nobody expected becomes a question for the people who run the business. That is where the edge cases come from. Not from the documentation, and not from the AI’s imagination, but from the old system being asked thousands of questions and somebody curious reading the strange answers.

The costs are real. Personal data has to be masked before anything is stored. Emails and payments have to be stubbed, or a test run charges a customer. Timestamps and ordering create false alarms until you normalize them. And the recording only proves the cases it saw.

What you end up with is a baseline: thousands of inputs with the answers the business has been living with for years. Bugs included.

Build the new piece against the old answers

Now the new module has an exam to pass, and the examiner is not the AI that wrote it. It is the old system’s recorded behavior.

e0419db6fe142250dab7438d865566c6.gif

Every difference lands in one of three piles.

The new code is wrong. Fix it.

The old code was wrong, and someone depends on it. Keep the behavior, and write down why.

The old code was wrong, and the business wants it fixed. Change it on purpose, with a name next to the decision.

The second pile is the uncomfortable one, and it is where modernizations quietly break. A rounding error from 2009 may be in a contract by now.

An agent can tell you the two systems disagree. It cannot tell you which one the business wants.

Move the traffic, not the date

When the baseline is green, the new module goes to production next to the old one. Both receive the same inputs. The old answer is still the one that counts, only one of them writes, and every mismatch is logged.

40fea141a8c9dc8c992f4a441db719c2.gif

Then traffic moves gradually: one office, one group of users, a percentage. Every step can be rolled back. The old module is retired when the differences have stayed quiet through a full cycle, not when a calendar says so.

Running both costs money, and it should be said up front. It is still cheaper than finding the December rule in December.

Then the next module. Each new one ships with its pipeline, its monitoring and its recorded tests, so the system the team inherits can keep changing.

None of this is new. That is the point.

Recording behavior before changing it is what Michael Feathers called characterization tests two decades ago. Replacing a system piece by piece from the edges is Martin Fowler’s strangler fig. Running old and new side by side and comparing is what GitHub did with Scientist when it rewrote its permissions code.

What AI changes is the cost. Reading everything, proposing thousands of scenarios, sorting differences overnight: that work was always worth doing and rarely got a budget. The agents doing it are the replaceable part. Today it is Claude, Cursor or Gemini, and next year it will be something else.

What stays is the loop: read, record, rebuild, run both.

That file with DO NOT MODIFY at the top is still there. The difference is that now you know exactly what it does, and you can prove it. You can finally modify it.

Where this goes next

This loop is the engine inside Legacy to Modern, the way we do modernization at White Prompt. The service has four phases: AI Code Archaeology, Architecture Design, Surgical Migration and Validation & Handoff. The page has a video, just under two minutes, that tells the whole story with the two mountains.

What I value about it is what it refuses to sell: the jump. The route is designed around your system, your team and your budget. Your team is trained as each module ships, and the knowledge base and the recorded tests stay with you. The aim is autonomy, not dependency. If you want continuity, an engineer who already knows the new system can stay through staff augmentation.

You do not need anyone to take the first step. Pick the module everybody is afraid of and write down ten things it does that no document mentions. If the list comes easily, you already know where your path starts.

Share

Ready to Build Something That Lasts?

Let's talk about your project. We'll bring the engineering judgment and the speed to ship.