Andreas Jacobsen's Distraction

Another cause of procrastination

Don’t leave broken windows in your code

leave a comment »

This article at the Economist discusses research that shows that the visual state of an area primes people’s behavior. If an alley contains graffiti, people are more likely to litter. This effect is called the “broken windows” effect. The original idea was that broken windows would lead to more vandalism and eventually break-ins and more serious crime.

In my experience, something similar applies in codebases. Excusing a bad practice one time makes it easier to excuse another one later. And even worse, the effect is compounding. A little litter doesn’t affect people as strongly as a lot.

So don’t leave broken windows in your code. Run a tight ship and don’t let others do it either. There are several ways to do this. Static analysis tools, test coverage metric requirements and plain old code QA all help. More than that, go even further and always clean up code when you find something messy.

Written by Andreas

November 24, 2008 at 10:58

Posted in Code quality

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.