It’s Harder to Read Code Than to Write It

I just ran across this article by Joel Spoelsky, in which he explains that programmers have a tendency to want to throw code away and start over because “it’s harder to read code than to write it.” So true, and something I want to keep in mind next time I want to trash some code.

Here’s an excerpt from the article:

There’s a subtle reason that programmers always want to throw away the code and start over. The reason is that they think the old code is a mess. And here is the interesting observation: they are probably wrong. The reason that they think the old code is a mess is because of a cardinal, fundamental law of programming:

It’s harder to read code than to write it.

The idea that new code is better than old is patently absurd. Old code has been used. It has been tested. Lots of bugs have been found, and they’ve been fixed. There’s nothing wrong with it. It doesn’t acquire bugs just by sitting around on your hard drive. Au contraire, baby!

Supporting his point is the fact that this is a fifteen-year-old article and just as relevant today ;)