Replacing legacy systems without stopping operations

A system that has grown over years is replaced piece by piece, not on one cutover date. Agents speed up the legwork. What the old system really does has to be pinned down by tests first.

An application that has been running for ten years contains ten years of decisions. Many of them are in no document, only in the code: the rounding one customer once asked for, the special case for one federal state. Whoever rewrites the system in one go loses exactly those spots and notices on cutover day.

Piece by piece

Martin Fowler named the alternative after the strangler fig, a plant that takes root on a tree, grows around it, and replaces it bit by bit. The new system grows around the old one. A layer in front of both decides, per function, which one answers. First a small, clearly bounded part moves over, then the next. The old system is switched off when nothing arrives at it anymore.

The advantage is not elegance but risk: every step is small, goes into production, and can be taken back.

Pin down first, then translate

Before the first step comes work nobody likes: pinning down what the old system actually does. Not what it should do. Michael Feathers calls these characterization tests. You send inputs through the old code and record the outputs as the expected result, even when they look odd.

This is where agents help most. They read old code patiently, find the branches, and write a test for each. Legwork becomes a task that can be checked: the tests run against the old system and have to be green there.

Where agents are good and where they are not

Good:

  • Writing tests from observed behavior.
  • Carrying a module over into another language mechanically, as long as tests check the result.
  • Finding the callers of a function and adapting all of them at once.

Not good:

  • Deciding whether an odd behavior is a bug or a rule somebody relies on. Only the business side knows that.
  • Migrating data without anyone comparing the numbers before and after.
  • Choosing the cut, meaning which part goes first. That is a question of risk and business, not of code.

Old and new side by side

Before a part is switched over, both systems run with the same inputs and the results are compared. Every difference is either an error in the new code or a rule nobody knew about. You want to know both before the switch.

For interfaces to the outside, to banks or authorities for example, an adapter goes in between: the new core speaks one format, the adapter translates into that of the counterpart. If the counterpart changes, the adapter changes and not the core.

What it costs

On the plan, a step-by-step replacement looks slower than the big rewrite. For a while two systems run, and the layer between them has to be maintained. That is the price of operations never standing still for a day.

Sources

Discuss a project

Send us the project goal, current state, and main bottleneck. We will respond with a clear assessment.

office@sftwrk.at
Phone
+43 699 172 948 71
Address
Stefan-Fadinger-Straße 20, 4600 Wels, Österreich