Fix your broken window!
Sept. 22, 2010
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. Because I'm a 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 a brand new project and how, after a couple of weeks, this code is still nice and shiny even if you are working together with 2 other programmers. Now back to reality, when you are working on an old project you usually see lots of ugly code. Do you think that those projects have started with ugly code? No, usually it's not the case. 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 breaks 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 breaks 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 breaks 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.
More information about Broken windows theory.