We who cut mere stones must always be envisioning cathedrals.
-Quarry worker’s creed
That quote comes straight out of one of my favorite books: The Pragmatic Programmer. Ever since I stumbled on this book four plus years ago I have been an evangelist for its teachings. I read the author’s blogs (PragDave, and Andy’s Blog) religiously and I keep hoping the Rails Studio will make a detour to the Midwest.
Anyway, one of my absolute favorite pearls of wisdom from Pragmatic is “Don’t Live with Broken Windows.” Basically, a car in a seedy part of town will be left untouched until a single window is broken – then it’ll be stripped in a matter of hours. For more on the theory, check out the Wikipedia entry: Fixing Broken Windows.
This theory was brought to my attention today in a code review. Not that the code was bad (though truthfully, I don’t know enough about the business yet to be able to do more than “that variable name isn’t very descriptive”) but it had some dead code in it. I’ll admit, there was a time (a brief while) when I didn’t mind having lines and lines of commented out code but not anymore. With version control (you do use version control right?) there just aren’t any good reasons to keep unused code around. All you’re doing is making the code harder to read – and most of us prefer writing code anyway! A simple thing, sure, but next time you’re editing some source and you run into a chunk of code that the compiler is ignoring do yourself and everyone else in your shop a favor and burry that code for good. You can always look back at the history in your version control…