Chesterton's Fence

Posted on Fri, Apr 2 2021 in Bob's Journal

There is a guiding principle of second-order thinking explained by G. K. Chesterton in his book The Thing.

There exists in such a case a certain institution or law; let us say, for the sake of simplicity, a fence or gate erected across a road. The more modern type of reformer goes gaily up to it and says, “I don’t see the use of this; let us clear it away.” To which the more intelligent type of reformer will do well to answer: “If you don’t see the use of it, I certainly won’t let you clear it away. Go away and think. Then, when you can come back and tell me that you do see the use of it, I may allow you to destroy it.”

While Chesterton was thinking of social structures, this is a good principle in many areas, including computer software. Many of us in the early days of our programming careers (because of course, we've all learned our lesson and never fall for this anymore) come across a line of clearly useless code. Its removal would improve readability and have no negative impact, and so it is discarded. Only later did we discover that that piece of code was instrumental in preventing some error we hadn't even realized was possible.

After a few such encounters, a programmer tends to become superstitious about such sections of code. If you don't have the time to understand it deeply (and in the modern business world, who does?), you just leave it alone and hope for the best. To return to the fence analogy, we could remove the fence, but that would mean taking responsibility for understanding it. Maybe it really could be removed. Maybe a speed bump or warning sign would be more appropriate, but it's hard to say. Instead, the enterprising programmer leaves the fence in place, but jams a stick in the hinges to hold the gate open.

The drivers are delighted that they can now barrel down the street without having to stop and open the fence, until that fateful day when the stick breaks or wiggles loose and the fence slams shut in front of a car traveling at fifty miles per hour.

The next programmer comes along to investigate the wreck and he isn't looking at the fence anymore. Now, he wants to understand the stick. After considering it a while, he decides he needs a stronger stick, or one that's differently shaped. Or perhaps he just needs to use some glue to hold the stick in place better. When that fails, more modifications are made to the stick, and eventually modifications begin being made to those modifications.

Finally, someone gets sick of this mess with the pile of twenty sticks held together with twine, mud, and glue, and reroutes the traffic along a mud path alongside the road. Of course, this path is more treacherous and we need a way to make traffic stop and consider the road ahead of them carefully. So a fence is added.