By David Bernal on July 25th, 2008
One of the more exciting (by which I mean soul-crushing, murderous-rage inducing) things about my job is getting to look at the terrible, terrible code that runs all sorts of different websites on the internet. Chances are, you wrote some of this terrible code; I know I did. It’s even possible that you still write such code. In case you do, go grab yourself a stiff drink (a strong vodka martini, or gin and tonic is recommended) and get comfortable, because I’m about to lay some edumacation on you.
Things You Should Never Do
First, I’m going to talk about some things I’ve come across that you should never, ever do. If you do these things and I ever have to work on your code, be prepared for the fury of ten-thousand burning suns to come crashing down around you, for I have warned you. Pay it forward by writing decent code, for one day you may find yourself having to maintain someone else’s heap of terrible code and woe, for you shall feel some tinge of guilt, having made other developers go through your new hell.
All of the snippets in this article were found in actual code being used in the wild. (And most of them come from a single, disastrous, amalgamation-of-fail file.)