The Hardest Part of Rewriting Old Software Is Deciding What It Should Do

By Reviuws AI Editor · Published

A decades-old program is rarely just code. It is also an accumulation of business decisions, emergency patches, undocumented exceptions and accidental behavior that users may have learned to depend on.

That makes automated modernization more complicated than translating syntax. According to a recent research paper, AI systems were able to migrate legacy COBOL programs into Java while retaining bugs from the originals. At first glance, that sounds like a failure. In another sense, it is evidence of impressive semantic fidelity.

The deeper problem is that neither a human translator nor an AI model can reliably distinguish a requirement from a defect by looking at implementation alone.

A perfect mirror can reflect the wrong thing

Organizations often frame legacy migration as a language problem: take code written in an old language, express it in a modern one and preserve the outputs. This framing encourages teams to measure success through behavioral equivalence.

If the Java replacement produces the same result as the COBOL system for a broad collection of inputs, the migration appears successful. Yet equivalence only proves that the two systems agree. It does not prove that either system is correct.

An off-by-one error in an interest calculation can be translated perfectly. So can a mistaken eligibility rule, an incorrect date boundary or a branch that silently mishandles missing data. The new application may be easier to deploy and hire for, but it can remain functionally trapped in the past.

AI makes this tension more visible because models are increasingly good at reproducing observable behavior. That skill is valuable, but it can create a dangerous illusion: the cleaner the generated Java looks, the easier it is to assume that the underlying system has also been cleaned up.

Migration is really specification recovery

The missing ingredient is an oracle that defines intended behavior.

In an ideal project, that oracle would be a current, precise specification backed by comprehensive tests. Many legacy estates have neither. Documentation may describe an earlier version of the business. Tests may cover only the happy path. Original developers may have retired, while current operators understand workflows without knowing why the software implements them in a particular way.

The running program then becomes the de facto specification. Teams feed it historical or generated inputs, record its outputs and require the replacement to match. This technique can detect translation errors, but it also canonizes existing mistakes.

Recovering the real specification requires evidence beyond source code: regulations, accounting policies, support tickets, database constraints, audit records and interviews with domain experts. It may also require comparing behavior with what customers were promised rather than what the software happened to deliver.

This is expensive work. It is also the work that determines whether modernization improves the system or merely changes its packaging.

Some bugs have become unofficial features

Not every divergence from written documentation should automatically be corrected. A longstanding quirk may be embedded in downstream reports, contracts or employee routines. Fixing it without understanding those dependencies can cause more damage than preserving it.

That complicates the familiar instruction to “remove the bugs.” Before changing behavior, teams need to classify it. Is it a confirmed defect, a tolerated anomaly, a historical policy, or an undocumented requirement? Does another system depend on the same unusual output? Would correcting it alter customer balances or trigger regulatory obligations?

The right migration target is therefore not always the old implementation, and it is not always an idealized specification. It is a reviewed behavioral contract that explicitly identifies what must remain, what must change and what still requires investigation.

What builders should do differently

Teams adopting AI migration tools should separate translation from validation. One model or workflow can produce a functionally equivalent implementation. A different process should challenge that equivalence by searching for suspicious behavior, contradictory rules and edge cases.

Builders should also preserve traceability. Generated methods ought to map back to legacy modules, business rules and test cases. When the new system produces an unexpected result, reviewers need to know whether that result came from the source program, the translation process or a newly introduced assumption.

Tests deserve similar scrutiny. Automatically generating tests from the old program is useful for regression coverage, but those tests answer only one question: does the replacement behave like its predecessor? Teams also need tests derived from independent requirements and domain invariants. Account balances should reconcile. Dates should respect policy boundaries. Totals should remain internally consistent. Impossible states should be rejected even if the old program accepted them.

AI can help uncover these invariants, but it should not be treated as their ultimate authority. A model trained on code can propose likely intent; it cannot know an institution’s unwritten obligations without relevant context.

The model competition moves above code generation

For AI vendors, raw translation accuracy may soon become table stakes. The more consequential competition will involve context gathering, uncertainty detection and explanation.

A stronger migration system would flag branches whose behavior conflicts with documentation, identify outputs that violate inferred invariants and show where multiple interpretations are plausible. Rather than confidently generating one replacement, it might present a decision log: this behavior was preserved because tests require it; that behavior was changed because a policy document supersedes it; another case needs human review.

This favors systems that can work across code, tickets, schemas, manuals and organizational records. It also raises the value of models that admit ambiguity instead of smoothing it away. In legacy modernization, calibrated uncertainty may be more useful than polished confidence.

What to watch next

The next benchmark should not ask only whether AI can reproduce an old system. It should test whether tools can identify likely defects, explain the evidence and avoid changing legitimate edge cases.

Watch for migration platforms that combine differential testing with requirements analysis, invariant discovery and human approval. Also watch how vendors define “success” in case studies: fewer lines of COBOL is easy to measure, while recovered business intent is not.

AI may dramatically reduce the cost of rewriting legacy software. But unless organizations invest in deciding what the software ought to do, they risk achieving a technically elegant result: the wrong system, rebuilt perfectly.