Recently there was some chatter in the blogosphere on something called the broken windows theory from Malcolm Gladwell’s book The Tipping Point. All of a sudden everyone was all “broken windows this” and “broken windows that” and I was like, “broken windows what?” So I turned to my trusty Wikipedia and discovered an entry on Fixing Broken Windows. The article describes a theory from a book of the same title based on an article from the Atlantic Monthly in the early 80s. The following excerpt explains the gist:
A successful strategy for preventing vandalism is to fix the problems when they are small. Repair the broken windows within a short time, say, a day or a week, and the tendency is that vandals are much less likely to break more windows or do further damage. Clean up the sidewalk every day, and the tendency is for litter not to accumulate (or for the rate of littering to be much less). Problems do not escalate and thus respectable residents do not flee a neighborhood.
I thought to myself, “Hmm. I like this theory. Whether or not it’s true in some kind of empirical way, I think it’s a good way to live. A personal ethic, if you will.” So I linked to the Wikipedia article on my blog and went about my business.
Until a friend replied with a link to an article on Ward Cunningham’s patterns in software development wiki called FixBrokenWindows. The wiki page relates this sociological concept to programming and computer systems—which caused this catchy metaphor to creep through my consciousness. What they had to say on the matter I found very compelling, and perhaps more importantly, I found it to be immediately applicable in my daily work, and I’m probably not alone.
Here’s a choice excerpt:
Context: Software seems to be subject to entropy. Things that used to work stop working. Ideas that seemed good at the time, seem poor 3 months later. Interfaces get ugly. It’s easy to find yourself surrounded by code that has niggling things wrong with it, or that’s just plain bad.
The problem: When you’re surrounded by ugly things, your attitude and outlook change. You become pessimistic, and your expectations are lowered. Soon you start accepting that “that’s just how things are.” You start producing ugly things yourself.
Therefore: Don’t live with broken windows. Fix things when you see them. Refactor when you can. If you can’t make the change right then, put some kind of flag in place (like a FixmeComment) to at least acknowledge that you’ve recognized a problem, and to tell people that someone cares and is on top of it. Stop rot while it’s isolated.
The Flipside: People respect well maintained things. Beautifully restored vintage cars are treated with reverence. People take off their shoes when entering well-cared for houses. A good way to get other developers to treat your systems with respect is to keep it looking cared-for.