Sam Gentle.com

Zombie code

I've been trying to do some stuff with OpenGL lately and, uh, wow. I don't know if it technically qualifies as the worst API I've ever seen - there's some fairly robust contenders in the "enterprise web services" category - but it's definitely got a straight run at the title. I remember it being a bit gross when I used it a few years ago but if anything it's managed to get even worse. It's layer upon layer of new features melted over a terrifying spongey core of half-arsed backwards compatibility.

Anyway, it got me to thinking about that funny thing that happens with code, where it sticks around long past its use-by date. I'm fairly certain an old mailing list system I wrote in an afternoon in Python nearly a decade ago is still kicking around in production somewhere (sorry). But every time I still manage to convince myself that this time it really is temporary, and someone totally will come along and fix it later. Unfortunately, nobody ever does.

I've wondered sometimes if the right answer is just to always write code as if it's going to last ten thousand years. I don't mean write it so it could cover every eventuality into the far future, that would be awful. But maybe, if you were diligent, you could always write code with a certain essential craftsmanship. Code that you wouldn't be ashamed to see dug up in ten thousand years.

Or at least the next six months.