The city of New York is doing After 100 Years, a New Rule Book for New York”>a complete rewrite of its building code. They’re throwing out their existing code and rewriting it from scratch. Maybe it’s because I’m myopic, but the first thing I thought of when I found out about that was the similarity of computer code and law.
Lots of coders get to the point with unwieldy code where they want to throw it out and start from scratch. Take Things You Should Never Do, Part I from Joel on Software:
Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We’re not excited by incremental renovation: tinkering, improving, planting flower beds.
That sounds an awful lot like what they’re doing with the building code, saying that it’s completely unmanageable and needs to be rebuilt from scratch. Compare
“The code reflects the experience that has been accumulated in New York City over a century,” said W. Gene Corley, a structural engineer who led a federal investigation into the World Trade Center collapse. “It has codified those things that are needed to provide the safety the public expects.”
The programmer might have spent a couple of days reproducing the bug in the lab and fixing it. If it’s like a lot of bugs, the fix might be one line of code, or it might even be a couple of characters, but a lot of work and time went into those two characters. When you throw away code and start from scratch, you are throwing away all that knowledge. All those collected bug fixes. Years of programming work.
The solution to this instinct in the software world has been to refactor the code, to go through and clean up the parts that are messy while not changing what it does. I don’t think that solution would work well in law simply because everyone in charge of the law is trying to get re-elected and code maintenance doesn’t win votes. Good thing, too, because it would put those “It’s illegal to ride a squid on main street” odd law books out of business.
The urge to rewrite isn’t the only similarity between law and software. There’s been battles over copyright on law text which echo the issues of open source software. Ultimately software acts as physical laws for computer mediated environments, where government provides social laws for the real world. I wonder how much law makers and software engineers could learn about their processes from each other.