Thursday, 16 November 2017

On Broken Window Theory and Cake

Occasionally, among my varied interests, I enjoy cooking. I find that it is one of mankind's most interesting practical applications of Alchemy, but that is a Blogpost for another day. I recently baked two cakes for my colleagues at work. I had no special reason for doing it besides the joy of cooking.

In this case it provided a perfect example of the Broken Window Theory1.

I put the two cakes on the counter of the cafeteria, as soon as I came in that morning. Two hours later, I noticed that both cakes were still in one piece.

My colleague and I surmised, that this was because the cake was still undamaged. To test this, we both took a piece of cake. With two hours all but a small bit of one cake remained and at the end of the day, the second cake suffered a similar fate.

Note: interestingly enough even a perfect cake will suffer, if it sits next to a cake that is already in the process of being eaten.

On code

Of course, a similar conclusion can be drawn from your code. If your code is a work of beauty, naturally people who need to make changes, will do so with respect for the beauty of the code.

With code that is already showing wear and tear, or code that has originally not been well designed, this process of entropy is increased dramatically.

It is in many ways similar to the design principles of the Boyscout Rule2 of Uncle Bob.


[1] Wikipedia - Broken Window Theory
[2] O'Reilly Commons - The Boy Scout Rule

1 comment: