Be honest: have you ever looked over your own code and felt like you had to redo it? One may think “I can do it so much better now”, but if the deadline is approaching and delivery is due, how many are capable of ignoring the urge to redo without loosing an arm and a leg? Let me rant about the subject.

I remember giving to a co-worker the source code of a program I had written a few years earlier, when my coding practices weren’t exactly as I would like them to be. “I wrote this 3 years ago!” – I said, as if meaning “I don’t know who’s the idiot who wrote this code, but it wasn’t me, OK?”. Chances were that she didn’t care, but nevertheless I was faced with code that I had done myself and that I wished I could do again with my current skills. This case in particular was about the fear of someone else’s judgement, a judgement that would not take into account the developer that I am today, but the one I was.

But the urge to rewrite code is not just about other people: sometimes you are a team of one; other times you are in a team of more than one, but you want to rewrite parts of the code for the sake of its own quality, not someone else’s opinion. This very website fell victim to this perfectionism, as I would constantly switch layouts as I found a better one. This constant insatisfaction meant that I was never – ever – releasing the website. It also meant that the time I was using to try many layouts (to later discard them) wasn’t being used to write new content. As the release of my website was under no deadline, I could go on with this perfectionism indefinitely. It’s when self-criticism and deadlines meet that you have a problem.

The self-criticism per se isn’t bad, of course. For me it’s a symptom of my evolution as a programmer. The problem lies on the urge to redo that arises when this feeling hits hard. If you have to deliver a new feature, or write new content, a refactoring may be the right thing to do in the wrong time. Naturally, we don’t keep adding new features forever: if even hardware has to face manutention every now and then, can you imagine software (though convincing your manager likewise is a different matter). Understanding when the urge to redo will happen is key to make it fit on the manutention window. To me, the two basic factors that define this urge are the self-criticism and how much the skills evolved in a given time frame:

The urge to redo

Very self-critical, perfectionist people will have more urges, even when Δ evolution is small. On the other hand, even a self-forgiving person may want to rewrite code if his skills have evolved significantly ever since he wrote the code.

Of course, this is not a formal theory, and it applies to specific situations such as those when one has to work on a single project while his skills are evolving. I have a few suggestions to adress this issue, but I’ll leave that to my next post.

This entry was posted by on Sunday, December 23rd, 2007 at 5:39 pm and is filed under IT. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply