Legacy Code and Sacred Texts
Why nobody rewrites the old code, and what it costs.
Every programmer who has worked in a large company knows the module. It was written fifteen years ago by someone who has since left. Nobody fully understands it. It has no tests. Everything depends on it. And there is an unwritten rule that you do not touch it. You call it, you wrap it, you work around it, but you do not change it.
I have spent a lot of my life around code like that, and also a lot of my life around religious texts. At some point I noticed that they are the same thing. Not as a metaphor, but in the way they behave over time. Both are texts that cannot be rewritten, that must keep running in a world their authors never imagined, and that therefore accumulate interpretation and workarounds until the workarounds are bigger than the original.
The rule that cannot be broken
Legacy code becomes untouchable for a simple reason: too much depends on it, and nobody is sure what will break. The cost of changing it is unknown, so it is treated as infinite.
A sacred text becomes untouchable for a stronger reason: it is believed to come from God. You cannot fix a bug in a divine commandment. If the text says something that no longer works, the text is not wrong. Your reading of it must be.
In both cases the result is the same. When the original no longer fits reality, nobody edits it. Instead, they add a layer on top.
Workarounds in the law
Jewish law is the clearest example I know, because it is so well documented.
Deuteronomy 15 commands that every seventh year all debts are cancelled. That is a generous rule in a small agricultural society. In a commercial economy it is a disaster: nobody will lend money as the seventh year approaches, which is exactly what the text itself worries about. Hillel did not repeal the commandment. He could not. Instead he instituted the prozbul, a document by which the lender hands his debts over to the court, and since debts owed to a court are not cancelled, the loan survives. The commandment still stands. It just no longer does anything.
The same seventh year forbids working the land of Israel. When Jewish farmers were trying to survive in the agricultural colonies at the end of the 19th century, a year without farming could have destroyed them. The answer, approved by Rabbi Yitzhak Elchanan Spektor among others, was the heter mechira: the land is sold to a non-Jew for the year, so it is technically not Jewish land, and it can be worked. It is still used in Israel today, and it is still argued about.
Carrying objects in a public domain on Shabbat is forbidden. So a city is surrounded by an eruv, a wire on poles that turns the whole city, legally, into one private domain. Owning leavened bread on Passover is forbidden. So it is sold to a non-Jew before the holiday and bought back after it, without ever leaving the cupboard.
Then there is reinterpretation, which is a workaround in the reading rather than in practice. "An eye for an eye" was read by the rabbis of the Talmud as monetary compensation. The rebellious son of Deuteronomy 21, who is to be stoned, was hedged with so many conditions that one opinion in the Talmud says such a case never happened and never will. The text is preserved word for word. Its meaning is quietly replaced.
Workarounds in the code
Now look at what software does.
COBOL programs written in the 1960s and 1970s still run a large part of the world's banking, insurance and government systems. In April 2020, when unemployment claims exploded at the start of the pandemic, the governor of New Jersey publicly asked for volunteers who knew COBOL, because the system that paid benefits was written in it and few people left could maintain it. Nobody had rewritten it in half a century. It was too important to touch, so it was never touched.
Microsoft Windows is famous for keeping old programs running. Joel Spolsky, who worked at Microsoft, retold a story from the Windows 95 team: the original SimCity read memory right after freeing it. It worked by luck on DOS. On Windows 95 it crashed. Microsoft did not ask the game to be fixed; they added code to Windows that detects SimCity and runs the memory allocator in a special mode for it. Windows is full of such shims: a whole compatibility layer whose only job is to keep pretending the world is still the one old programs were written for.
And every programmer has seen the function with one parameter that is ignored, kept only so old callers still compile. The flag whose name means the opposite of what it does. The comment that says DO NOT REMOVE with no explanation. Each is a small prozbul: the original stays, and something is added to cancel what it says.
Why it happens
The mechanism is the same in both cases.
First, the original authors are gone. You cannot ask Moses what he meant, and you cannot ask the contractor who wrote the billing module in 2009. The text is all that remains, and the text cannot explain itself.
Second, the world moved. The authors wrote for problems they knew. Debt cancellation made sense in a world without banks. Two-digit years made sense when memory was expensive and the year 2000 was decades away. Neither group of authors was stupid. They wrote for their world, and their world ended.
Third, and most important, there is a belief that the original must not be changed. For code it is fear: nobody knows what will break. For scripture it is faith: the text is perfect by definition. Fear and faith produce the same behavior. The text is preserved, and the effort that should have gone into fixing it goes into interpreting it instead.
And the interpretation keeps growing. The Mishnah comments on the Torah, the Talmud on the Mishnah, the commentators on the Talmud, the codes on the commentators, and the responsa on the codes. Legacy systems grow the same way: a wrapper around the module, an adapter around the wrapper, a service in front of the adapter. In both cases a newcomer has to learn all the layers to understand anything, and the expertise needed to navigate them becomes a profession in itself.
The difference
There is one important difference, and it is the whole point.
Programmers know that legacy code is a problem. We call it technical debt. We admit that the module is untouchable because we are afraid, not because it is good. Every engineer dreams of the rewrite, and occasionally, when the cost of the workarounds finally exceeds the cost of the risk, the rewrite actually happens. The old system is retired. People are glad.
Religious traditions cannot admit this. The workarounds are not called debt; they are called wisdom. The prozbul is not presented as evidence that the original law failed, but as proof of the sages' brilliance. The fact that a text needs centuries of patching to remain livable is not taken as a sign that it was written by people for their own time, which is the obvious explanation. It is taken as a sign of its infinite depth.
A good engineer looks at a codebase where every rule has an exception that cancels it and draws the honest conclusion: the rules were written for another world, and they should be replaced. The same conclusion applies to the text. A rule that you must work around in order to live a normal life is not a deep rule. It is an old one. Which is also, I think, much of the reason the faithful lie: when the text cannot be wrong, something else has to give.
Legacy code at least has an excuse. Rewriting it is risky and expensive. Admitting that an ancient text was written by ancient people costs nothing but pride.