When we last left our intrepid developer he was attending a local RA (Refactors Anonymous) meeting. Let’s see what’s happening this week:
Me: “Hello everyone. My name is Tim.”
Group: “Hi Tim!”
Me: “I write software.”
Group: “So do we!”
Me: “I’ve been writing software for over 6 years now.”
Group: “That’s great Tim!”
Me: “And I write bad software.”
Group: There’s nervous stares around the room, shuffling of papers and feet. No one wants to acknowledge the 500 pound gorilla in the room. They all write bad code!
There. I’ve admitted it. I write bad code. I don’t intend to, but it just happens. At least that’s what it looks like to me. Every time I look back at a completed project, I can’t help but think I could have done this better or that better. Usually I have to fight the urge to go back and rewrite code just because I know think I can make it more efficient and more elegant. Then I remember that I need to keep making progress on current projects, and my dreams of incessant code rewrites goes up in smoke. So I go on writing more bad code, and the cycle continues.
I prefer to think that I’m becoming a better developer as I complete more projects, instead of thinking that I wrote bad code on older projects. I can think of specific tasks that caused problems for me at one time that I’m now able to easily handle. Does that mean I’m not writing bad code anymore? Probably not, but I’m writing better code than I used to. Shouldn’t that be our goal anyway? We should be continuously improving our skills and becoming better developers. That’s the 500 pound gorilla in the room. We all think we write good code, but there’s always room to improve. Especially in the tech industry because it changes so quickly, and there’s always opportunity to learn something new.
Now I want to know who’s going to clean up after the gorilla. I’ve got code to rewrite.





November 28th, 2007 at 4:14 am
That’s an ugly picture - too ugly for what’s trying to be just an amusing illustration.
November 28th, 2007 at 4:41 am
the best part about the fact that everyone writes bad code is that other people’s bad code provides an excellent opportunity to learn how NOT to do it.
I’ve got 7 years of dev experience, an SCJD, and I still wouldn’t pay money for most of what I write
November 28th, 2007 at 4:46 am
Remember the first code you wrote for a project … Why don’t you benchmark that against the code you wrote for your last project ? … Is there improvement … I have been working for a year now. I always no matter what have a opinion on how I can improve on what I just coded. Many a times I rewite too for worse. Like they say There is always room for improvement. Back to work now. The above pic is ugly.
November 28th, 2007 at 4:58 am
Its an unfortunate truth that the majority of programmers are too arrogant to admit this. Although its entirely understandable as you’d rarely get any profession being so frank about its own work. I think for anyone to develop though you need to rest ‘just south of arrogance’ and excercize an unbiased and critical review process for your own code.
Its not necessarily lack of ability that creates bad code but constraints such as time, workplace practices and environment issues too.
November 28th, 2007 at 8:12 am
The picture isn’t ugly. It’s sad.
I’ve been programming for more than 20 years. In my experience the gap between my code’s quality and perfection is narrowing (though never reaching zero), while at the same time my expectations are growing. So, while I’m making fewer mistakes now (by virtue of having made many) my tolerance for mistakes also becomes lower.
A few years ago I considered buggy code “bad”. Nowadays I also consider code “bad” that’s poorly documented, lacks consistent design, misuses useful paradigms or doesn’t follow my current coding style
My coding abilities evolve asymptotically towards what I consider “perfection”. There’s only so much you can achieve here. Eventually you reach a point where it doesn’t matter much anymore. Real growth is happening elsewhere.
I do not measure my ability as a programmer in “code quality” any longer. I measure it by the complexity of problems I can solve.
It’s the transition from mere handicraft to art.
November 28th, 2007 at 8:36 am
>> evolve asymptotically towards … “perfection”
That implies that after a while, one gets pretty close to perfection. I think that’s way over optimistic. Rather, we are all evolving asymptotically towards ‘rubbish’. We never get anywhere near perfection, except for the occasional few snippets of code in the world, a handful of lines, each honed by academics over the course of many weeks, months or years. Enough code to demonstrate a point - never enough to be a complete module, never mind an actual program. Most of us will never even write a single snippet of code that exceeds ‘rubbish’ in quality. The sooner you realize this, the better a software engineer you are. Everyone who hasn’t realized this yet is not just significantly worse than ‘rubbish’ - they are outrageously deluded about it to boot, and commensurately more dangerous.
November 28th, 2007 at 11:46 am
That picture is REALLY so sad and disturbing. Didn’t you think about the scene in that picture?
November 28th, 2007 at 7:51 pm
Well not only do I write bad code, but it appears I picked the wrong picture for this post. I changed it to something a little less “disturbing”. For the curious, the original is here: http://www.scartech.net/wp-con.....orilla.jpg.