If you walk through a part of town that makes you feel unsafe, what is contributing to that? An unsettling feeling that something is likely to go wrong, no doubt. It is your brain interpreting the evidence all around you. Rundown buildings, litter on the streets, the vandalised car. If these things happened, then more bad things can happen, a basic cause and effect analysis. This extreme case is generalisable to most processes of decay.
It isn’t a sudden 0 to 100, it is step by step.
The premise we are building upon today is that purity is an unstable equilibrium. Meaning any deviation from that balance leads to it spiralling out of control. Like a marble balancing on an overturned bowl. A pristine balanced system that exists only while it is undisturbed.
The broken windows theory is a criminological theory that states that visible signs of crime, anti-social behaviour, and civil disorder create an urban environment that encourages further crime and disorder, including serious crimes.
A perfectly good suburb has a shop shut down. Kids like to play in the street as cars don’t come by very often. No one is currently leasing the space and a child accidentally breaks a window while playing in the street. They are scared of the consequences so they keep it a secret. No one will fix it or report it because it is not their problem. Now the purity of that street is violated, the next kid who breaks a window is not going to feel as bad because the shop was already damaged.
It is far more impactful to go from 0 to 1.
An infinity percentage increase in damage, to be precise. Whereas going from 1-2 is only 100% increase, a far cry from infinity. From 2-3 is only 50% and so on. While the absolute damage done is the same (1 window per time) the relative impact feels diluted. We rationalise actions by relative impacts, it helps us convince ourselves that the impact is lesser. It’s natural, as children we compare our actions to our peers, why are we punished more than our friends for the same actions. It feels UNFAIR! Things only have meaning in reference to other things.
If things are only clear relative to the status quo then we can see how one broken window, leads to two broken windows. But then the person who litters feels the same lessening of impact. The graffiti artist isn’t disturbing a pristine area anymore. The vandal who takes out the lamppost feels emboldened. The ominous looking teenagers that want a place to underage drink and get rowdy feel safer in the dark. The drug deal. The mugging.
Suddenly each step feels a little closer with each previous step.
why is ‘writing code’ like ‘living life’?
This criminology theory is used in programming to demonstrate how codebases that are well-considered and clean at the beginning slowly become a decaying mess of spaghetti code that is impossible to work on.
“Uncle Bob” is one of the foremost thinkers on this idea in his book Clean Code.
A principle he proposes as part of the solution is investing in writing tests early on. Tests are automated code that test your functions to see if they do what is expected from them. That way when you add to it you can quickly check that all the old code still does what it was supposed to, checking that you haven’t broken any windows.
The thing is, at the beginning often you are being rushed, the budget of the project is small or non-existent, you are being managed by someone who does not understand this principle and just wants to see results (because they are under the same time pressure). It is especially easy to cut these corners at the beginning, because the project is small, you know every part of it and maybe are the only person working on it. Investing in these tests yields no benefit at the beginning.
THE BEGINNING, IS THE MIDDLE, IS THE END
The thing is that as it grows you have built the status quo to be “no tests, rapid output, no slowdown”, that doesn’t just go away by itself. So as you add more and more it gradually grows out of scope of what you can hold in your head at one time, your project expands to two people and the new person has a slightly different style. As they do not know the ins-and-outs of the entire project they break a window in their first week. There’s no tests. You don’t catch it.
They break a second window in their second week, you see it but because it has not caused any issues you start the relax your guard. Does it really matter if we cut corners? “We’ll fix it later” is the age-old rationale that never comes to pass. This is what is meant by “technical debt”, you either pay it or the symbolic loan-shark comes to break your company’s legs.
The standard you set at the beginning continues through, being disciplined while it doesn’t seem necessary is how you never have to find out that it was necessary. Writing tests is like insurance, by the time you realise you needed it, it is too late to take it out. They don’t cover existing conditions.
Why am I digging into this so much? It is to prove that something as innocuous as a broken window is symbolic and applies to any pursuit. It is a slipping of standards, and it is a signal to others that the standard has slipped. Incrementally we descend into chaos. You don’t give up on something you are passionate about, your hobby, your relationship, overnight. It is a gradual decay. Entropic.
You don’t slip into a chronic bad mood in one moment, it is a series of broken windows.
Entropy is the only constant
It is not making your bed, then because your sheet is on the floor you feel fine leaving your dirty clothes out, you’ll just wash them all together later. Then because you are surrounded by mess you don’t wash your dishes, you forget to shower, you do not do the laundry; you’ve been busy. You do not brush your teeth, you’re dirty anyway. Everything is such a mess, you procrastinate solving these issues until it’s late, then realise you haven’t eaten, but the shops are closed now so you just eat the chips in the cupboard. You haven’t done anything all day which makes you sad so you try to escape into Netflix late into the night. This messes with your sleep and you wake up late, unrested, obviously not going for that run today. Not going to make your bed this morning, hah, and it continues in frustration, self-flagellation and pain.
This may seem almost comical. Or extreme. Depending on your life experience and personal character. But this is how it begins. All the while the inner critic is telling you off, dragging you down. This is your own little mental “suburb” degrading into a part of town you don’t want to walk through at night.
how much is too much?
The thing is, we have the tools to repair broken windows, if we take the time to find them.
We need to invest in “writing tests” for our lives. Not just waiting for the “bugs” to show up in front of our customers before fixing them. Journalling is that for a lot of people, meditation can work for some, therapy for others, having check-ins with trusted friends or family. Anything that draws attention to any windows that are cracked. Set up these strategies before you need them. They are your insurance, your functional tests, your community watchdog fixing up the broken shop windows before people start getting mugged.
Fixing the problem when it is small and manageable, when it seems like it’s not that serious, is the best time to do it. Waiting for it to need to be solved is already too late.