Skip to content

Engineering: Modernize, don’t rewrite

Big-bang rewrites fail for predictable reasons. A port modernizes a system without one: behavior, data and contracts kept, parity proven, one module at a time.

· 5 min read

By Track49

Every team running a system on an aging platform hears the same pitch sooner or later. Throw it away and start again. This time we’ll do it properly.

It’s a tempting idea. The old code is hard to read, the framework is past end of life, and the people who wrote it have moved on. A clean slate sounds like relief, but it rarely turns out that way. There is another way to modernize. We call it a port: your system moved to a modern stack, every rule and record intact. Here is why rewrites fail, and how a port works.

Why rewrites go wrong

A rewrite starts by writing down what the system does. That sounds reasonable until you try it. The running system is the only complete description of its own behavior, and most of that behavior was never written down anywhere else.

So the new specification is written from memory. It captures the main paths and misses the edge cases: the reinsurance treaty exception that applies to one layer only, the rounding rule on a law firm’s trust-account interest, the cutoff time on a margin call. Those edge cases come back later, one support ticket at a time.

Meanwhile the old system keeps changing, because the business can’t stop while the rewrite happens. Now there are two moving targets.

And at the end, everything ships at once. One weekend, one switch, and every bug the new system has arrives together. If something goes badly wrong, there is rarely a clean way back.

None of this is a failure of talent. It is the shape of the approach: a rewrite reopens every decision, including the ones that were already right.

Your code is IP you already paid for

Here is the part that gets lost in the rewrite pitch. An old system isn’t only old code. It’s years of business logic: the rules your teams worked out, the edge cases they found, the fixes they made after something went wrong. Treaty allocations, trust-account postings, margin calls, currency reconciliations. Your domain, already codified once.

That is critical IP. You paid for it, and your people earned it. A rewrite throws it away and learns it again, one incident at a time. A port carries it across intact, and parity proves that nothing was lost on the way.

What a port is

A port treats the running system as the specification. It changes the stack underneath and keeps what the system does on top.

That means three things stay the same:

  • Behavior. The same inputs produce the same outputs, including the odd ones.
  • Data. The schema stays where it is, in the same shape. A port changes code, not records. Where the schema itself needs to change, that is a separate, explicit migration, not a side effect of the port.
  • Contracts. The APIs other systems call, the files partners receive, and the reports people sign off on all keep working.

What changes is everything that was holding you back: the end-of-life runtime, the upgrade treadmill, the dependency tree nobody can audit, and the hosting bill. Inside, the code is redesigned around the domain’s states and rules; outside, behavior, data and contracts stay the same. We port to Rust by default, to OCaml for trading and quantitative systems, and to Elixir and Phoenix for Rails teams who want fault tolerance and real-time concurrency.

None of this is a judgment on PHP, Node, Rails, Java or the single-page frameworks. They built a great deal of good software, and we still maintain and harden systems built on them. The problem is a specific version reaching end of life with a system on it that can’t move.

Parity is proven, not assumed

“It looks the same” isn’t a test. Before any module of a port switches over, we show it behaves the same, with evidence you can check yourself.

The permission matrix, compared. We build the matrix of who can do what in the old system and in the new one, then diff them. Every role should see exactly what it saw before. Any difference is either a bug or a decision, and decisions get written down.

Your existing tests, run against both. Whatever test suite the old system has, we run it against the new one too. A module isn’t done until both pass the same suite. Where the old suite is thin, we add tests that pin down current behavior before we change anything.

Outputs, compared by machine. Exports, reports and generated files are produced by both systems from the same data and compared by machine, not by eye. Fields that legitimately differ, such as generation timestamps and generated IDs, are normalized first, and the list of normalized fields is part of the evidence. Finance and compliance get the numbers they got before.

A simple version of that last check looks like this:

# Same inputs, both systems, timestamps normalized, then compare every file.
diff -r exports/legacy/ exports/ported/ && echo "parity: exports match"

One owner per module. Each module has one named engineer who signs off on its parity, so the sign-off never falls between people.

Cutover, one module at a time

Nobody should have to bet the business on one weekend. In a port, old and new run side by side, and traffic moves across one module at a time.

  1. Map. We map the modules, data, integrations and contracts, and agree on the order. Usually that means starting where the risk is lowest and the learning is highest.
  2. Port and prove. Each module is ported and passes the parity checks against the live system.
  3. Switch. Traffic for that module moves to the new code. The old path stays ready.
  4. Route back. If anything looks wrong, that module switches back while we fix it. Then we move to the next one.

The first module reaches production long before the whole port is done. You see real results early, and the cost of each step is visible before you approve it.

Ownership

When we port a system, the client owns the result. They have access to the repo, its history, the specifications and the tests from day one, and can run it in their own data center or cloud. A system that was stuck on someone else’s upgrade timeline is back on its owner’s, on a stack with a long support horizon.

When not to port

Sometimes the right answer is a plain upgrade, and we’ll say so. If the jump to a supported version is small and the system is healthy, upgrade it.

A port makes sense when the upgrade means rewriting most of the app anyway, when the runtime cost or the security exposure keeps growing, or when the platform has simply run out of road.

  • ports
  • legacy
  • rust
  • cutover