Fix your broken window!

As a programmer working with other programmers, I’m usually contributing to an already existing code base and basically just adding new functions or extending their functionality and because I’m person who could be influenced by others opinions, I also could be influenced by others code and code formatting.

For a moment try to remember what your code looks like if you are writing brand new project and how, after a couple of weeks, this code is still nice and shiny even if you are working with 2 other programmers. Now back to reality where you working at old project where is lots of ugly code. Do you think that project start with ugly code? No, usually it doesn’t. So what changed that nice code to ugly one? Why even if all of programmers are good and writing nice code does, this happened? The reason is what’s called the broken windows theory.

Broken windows theory as the name suggests is about broken windows(not the MS Windows though). Imagine a street with nice houses and white fences. One day, somebody brakes the window of one of the houses. After few days, nobody has fixed the window because the house is empty, even though it looks very nice. One of your’s neighbours kids then brokes another window and because there is already one broken, nobody cares that much and time goes by. After couple of months the house has a broken fence, a couple of windows and garbage all around it. Soon this ugly house will affect the behaviour of your neighbours as the surrounding area deteriorates. You may start to care about cleaning sidewalk, but by then, the whole street has started getting ugly and uglier.

This story represent exactly what happen to you brand new nice code if somebody brakes the window and nobody fixes it.

So behave to your code as a good neighbour and try to leave your code in cleaner state than was before your changes, the whole area will be nicer as a result.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.