Namsang Labs
Essay · #architecture #strangler-fig #msa #legacy-migration #refactoring

Ship of Theseus

· Sangkyoon Nam

Two eras of planks coexisting in one hull

There’s a story, as Plutarch tells it, about the Ship of Theseus. The Athenians preserved the ship Theseus sailed home in for centuries. When a plank rotted they replaced it with a new one, and then another.

When none of the original planks remained, the philosophers asked: is this still the Ship of Theseus?

Software engineering has a pattern shaped like this paradox. It’s called the Strangler Fig pattern.

A strangler fig is a tropical plant that grows around a host tree and eventually replaces it. The strategy of replacing legacy a piece at a time looks like that, so Martin Fowler gave it the name in 2004. Every time I see this pattern, the Ship of Theseus is what comes to mind first.

There’s a ship like this at my startup. It started as a Django monolith, with every feature in a single codebase.

As we moved to MSA we peeled features off one by one, and Django became a proxy that forwarded requests to each service. That was swapping planks one at a time. And now, even that proxy is being replaced with Spring WebFlux. It’s the last plank.

When this swap is done, not one line of Django will remain. Same name, same users sending the same requests, but none of the original code. Then we end up asking the question the philosophers asked. Is this the same service?

I think it’s the same ship. Even as the planks turn from wood to steel one at a time, if it’s still crossing the same sea and setting the same people down in the same harbor, it’s no different from the ship that first set out.

In software, identity lives in the contract, not the code. As long as the same users send the same requests and get the same responses, it’s the same service. Code is the plank that holds up the contract for a while.

Swapping planks is also how you carry the same contract faster, or to farther seas. Old planks won’t get you there.

In a startup, though, it isn’t only the ship that changes. The people rowing it change too. Roles change, languages change, the way we work changes.

The one thing that doesn’t change is the purpose: the same promise to the same users. To keep it, we choose to change ourselves the way we swap planks. That’s why we keep replacing them and keep asking the question.

Share this post