Primary Menu

Daily Archives: 30 September, 2009

There seems to be a trend amongst programmers who blog. They all tend to say that they write rubbish code. (Some put it more poetically than others…) I think it is a good idea to steer clear of the Rock-star programmers, but are all who blog, bad at coding? Or are they merely filled with a sense of modesty endued by self-preservation? (Needed because the Internet is a big scary place and you can’t hide from the knockers forever.)

From my own perspective: because quality takes time, there is always the sense that with more time I would have done a better job. That is probably true to a certain extent – but there is definitely a point of diminishing returns. That, plus the fact that I definitely have a finite amount of intelligence means that the quality of my code will probably never exceed a certain level. Someone smarter than me could possibly turn out better code than I could ever hope to. Extra intelligence however does not always guarantee better results. “Care” is an attribute that counts for a lot when writing code. “Careless programmers” write rubbish code and I find that particularly offensive if I know that they are better problem solvers / generally more intelligent than I am.

Reflecting on my own code at a later date often reveals a painful truth. Yes, I too write some awful code. Even code that I was once quiet proud of, I no longer see through rose coloured glasses. I probably notice this due to looking at the code from a different perspective. This is impossible to do at the time as you tend to be so engrossed in the code that it seems to be simple. (To me, simple code that works is a close approximation of good code)

Different perspectives for code arise with different usage of the code. Code that sticks to some simple rules lends itself to re-use. Code re-use is somewhat a holy grail of programming, but for a business, it is not as important as having the code you write make money. Joel Spolsky places a strong emphasis on finding good, talented programmers and judges them as the people who are smart and get things done.

Placed solely on this scale, I have known quite a few programmers who “pass”. But for some, there is a high price to pay, in the form of code maintainability. I willingly concede that for the sake of getting a “version 1.0” code base out the door and selling, making code “good” is a luxury. But carrying on with a relentless drive to push new versions out is counterproductive. Extending and maintaining a bad code base takes more resources and there have been documented cases where lack of progress due to the bad code base is the eventual undoing of a project.

Maybe this indicates that there are different sorts of “good programmers”. The ones who ensure there is a product to sell and the ones that ensure that sins of the past are dealt with in a timely fashion. I suspect software projects need both these types of programmers to succeed. I also suspect that these two groups of programmers annoy each other due to their different outlooks. But that’s a story for another time.