Jun 5, 2008

We're All Bad Coders

Yes, I said it. We all suck. Unless of course, you're not a coder. You can stop reading now, this stuff is trade secrets.

Do you write enough tests before you start coding to test all the various requirements of the application? Do you plan out how the interface will work? Do you do all this other crap that constitutes "good" coding?

I didn't think so. Neither do I. Even "famous" coders like Reg Braithwaite or Zed Shaw probably write bad code sometimes (heaven forbid). Why? Because we're lazy. Because we want to get things done. Writing good code tends to require more work up front that is better in the long-run but more annoying in the short-run. It keeps us from seeing the results that we crave so much. A major part of the desire to code is to see things work. The joy of seeing things work is one of the reasons why we code. So a lot of the time we just try to get the code done as fast as possible so that we can see the results.

This is a problem that we are aware of. Things like static-typing and garbage collection are great examples of things that are put into languages to protect us from ourselves. There are no pointers in newer languages. Why not? Because too many people messed them up. There are no more goto statements in modern languages. Scala even does away with break and continue. Why not? It makes people write code that is difficult to follow (Scala has more technical reasons to do away with them, due to those fancy things called closures). Yet people still write bad code. And guess what? I bet even with more and more fancy things to "improve developer productivity" we will still write bad code. The development platform doesn't necessarily save us from being human.

So yeah, suck it up. You're a bad coder. The least you can do is accept it. After that, try to improve. There is always room for improvement.

On another note, sometimes the development platform does matter:
foreach ($result_set as $row){
$filename = getFilename($row);
if (!file_exists($filenmae))
Let's hope there was a backup.

1 comment:

Hakushi said...

I'm not a bad coder!