Has your software got any broken windows?


The broken windows theory it's a theory that has been developed after some studies on criminology. It has been observed that if you park a car in a not-so-safe area, if all its glasses are kept intact, the incidence of act of vandalism or crimes on that care is much lower than if that car has one broken glass, even as small as a rear view mirror. In my personal experience, this applies also to different social behaviour (for example, what happened in my hometown some years ago).

On a more interesting note, however, this theory usually applies also to software development. Keeping your software at a high quality is definitely a challenging task, although this is made easier by using techniques such as Continuous Integration and Test Driven Development, to name a few.

But, what happens if broken windows start appearing in your software? Think about a poor designed class, like a god object, or methods which are not thoroughly tested. It's in the human nature starting adapting to that "chaotic" situation, and it's very likely that other developers will start adapting to the situation by writing bad code. As a result, quality will drop very quickly, and this is just because somebody started breaking windows in the code.

As craftsmen, we believe that we don't want only to write working software, but also to write well crafted software. A part from fixing the broken windows - with processes such as refactoring - we should mentor our team members to let them understand the problem, its importance that goes beyond the scope of that single method or class, and make sure this doesn't happen again. Pair programming, code reviews, automated code coverage checks are some of the methodologies/tools you can use to mentor people. Fixing broken windows is possible, but it's more costly and just by fixing probably you'll have to do this again and again.

By letting other people understand what they did and not to do the same mistake again, you'll need to spend less time on fixing rather than adding value, and also you'll pass some of your experience to your colleagues, as a true craftsmen should do.