Seeing your old code

January 17, 2010 | categories: Programming

Lately I have been working on one of my oldest pieces of code again. This code is that of a website I created for my school about 2 years ago, when I had just started programming.

Given that (a) it's written by a beginner (me two years ago) and (b) it's PHP, you wouldn't be surprised to hear that the code is bloody awful. Even for a basic CRD app (I hadn't programmed the U bit), it sucks.

Hardcoded numbers and categories everywhere, no sign of code organisation, redundant code, copy/paste as a design pattern and inconsistent naming. It's a wonder that information going into the database was even escaped. And let's not talk about character encodings.

Needless to say, now that I've picked up the code again, it's had a swift rewrite. It's still pretty crap, but at least it doesn't screw up completely if you type a euro sign.

Has anyone else ever seen some of their first code and gone: "I can't believe I wrote this crap"?