Friday, June 01, 2007

The best code of all

I had been planning to write a short essay today on how I felt that I have just completed a few very productive days, where my net code output has been negative to the tune of a few hundred lines.  After all, this is something I have touched on previously, albeit in passing, but I felt needed a bit more emphasis.

And then, in a fit of synchronicity, Jeff Atwood blogs on essentially the same topic, albeit from a different direction -- The Best Code is No Code At All.

It may be something of an acquired taste, but one of the best experiences I find in software development is the point where you are able to delete code.  In project terms, being able to do so marks the point at which the metaphorical rough-cut timber is finally getting sanded down and polished.  Source control systems are there to remember how things were, for good or for ill; so code that is obsolete, or that there is a just plain simpler and plainer way to do, can get the chop with a clean conscience.

While exploratory phases of development may involve a measure of throwing code at a problem until enough of it sticks, and on the first time, cut-and-paste may seem the more attractive code-reuse strategy, coding smaller will pay dividends in the long run.

Just don't leave the flabby code there expressly to get the deleting-it-all kick later.

Post a Comment