For seven or eight years, I ran a website called Britlinks. Over that time, it grew from a simple list of links to bands’ sites gleaned from altavista and usenet postings, to a large database of music resources with well over a thousand pages, and a sizable chunk of traffic. It let me cut my teeth with databases (first mSQL and then MySQL) and PHP, and to play with early versions of RSS for use on ‘my netscape’. It was also one of the earliest sites of its size to switch to an entirely XHTML/CSS set of templates, somewhere early in 2001.
As the site grew, so did the workload associated with keeping it up to date, sending out the regular email newsletters, and so on. This was well before the days of google adsense and short of signing up for ugly banner ads, making any real revenue from the site was simply an extra workload I couldn’t manage. Eventually, the site went into a forced hibernation. Two years on, I’ve switched it from hibernation to archive.
Preparing the site’s mothballs was a fascinating (and rather nostalgic) experience. I decided a major code audit was in order, particularly since a number of the libraries the site depended on hadn’t been maintained for several years. Much of the code was written when PHP3 was the only version of the language easily available on shared hosts, and there were a few dependencies on the evil that is register_globals.
It took some work to avoid the temptation to entirely rewrite the code, either with a cleaner PHP framework or even in Ruby, but I decided that for expediency’s sake to simply run through the existing code, switch over to new libraries ( MDB2 for the database, and HTML_Template_PHPLIB for the templates), make sure input and output are appropriately filtered, and clean up a few of the more egregious performance killers.
All in all, I’m pretty pleased with how it worked out. There are probably still a few issues that need addressing and once the site is bedded down at its new home I’ll probably do some more QA work. The XHTML could be a lot more semantic, and I’m tempted to add some microformats so the old data can be more easily parsed out by interested parties. Maybe.
Nostalgia aside, the exercise was a good reminder of the beauty of simplicity. The site could have done more, and probably more efficiently, had I employed OO principles and worked harder to ensure code re-use. But the simple procedural code was very easy to return to and there weren’t any concepts that took more than a few seconds to re-grasp. Performance tuning was a simple matter of cleaning up a few badly nested loops.
I wouldn’t go back to that method of web development. There are simply too many advantages to the modern techniques and frameworks that are part and parcel of my current toolkit, but the success of such simple code is a timely reminder that some things did work adequately before.