Consider Chesterton's Fence Principle Before Changing That Code
Posted on Thursday, 2nd April 2020
Let’s begin with a short story.
The sun is shining and you’re walking through a wood when you happen upon quiet, desolate road. As you walk along the road you encounter an rather peculiar placed fence running from one side of the road to the other. “This fence has no use” you mutter under your breath as you remove it.
Removing the fence could very well be the correct thing to do, nonetheless you have fallen victim to the principle of Chesterton’s Fence. Before removing something we should first seek to understand the reasoning and rationale for why it was there in the first place:
“In the matter of reforming things, as distinct from deforming them, there is one plain and simple principle; a principle which will probably be called a paradox. 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.”
As software developers we love writing code. Coupled with our tendency to want to prove ourselves we are often quick to identify code that we hastily deem as “bad” or “wrong”, especially when diving into an old codebase.
What we sometimes forget is that software isn’t designed and built in a bubble, it’s a bi-product of a series of complex interactions of events and factors.
Instead of jumping to conclusions we should first seek to control our impulse to simplify the things around us and be more cognizant of possible context or history by trying to understand why the ‘fence is positioned across the road’ in the first place. This is especially true for code that looks unusual or out of place. You may actually discover that the unusual approach has a valid reason for why it’s designed the way it is.
Similarly, the Systems Thinking, the Local Rationality Principle when summarised states:
“People do things that make sense to them given their goals, understanding of the situation and focus of attention at that time. Work needs to be understood from the local perspectives of those doing the work”
By going the extra mile you can gain a much deeper understanding of why the code or system you’re working on is build the way it is, what lead the developer to do something a particular way or what conditions they were under that led them choose a particular approach, because learning is not just about understanding new things, but also understanding design decisions and the trade-offs made of existing things.
Enjoy this post? Don't be a stranger!
Follow me on Twitter at @_josephwoodward and say Hi! I love to learn in the open, meet others in the community and talk Go, software engineering and distributed systems related topics.