Haven’t we been here before? (Originally published 4/26/07)

As programmers, we try to "factor out" repetitive behavior and logic whenever we can. At least that’s what we like to think. But when it comes down to it we repeat ourselves a lot.

(Hint: This is funnier if you take a deep breath and try to get it all out in one big rambling sentence… you’ll fail, but it’ll be funny)

We build frameworks so that we’ll never have to solve the same problem twice… at least, that is, until you change employers, the whole "intellectual property" thing kicks in and you have to try to re-implement your best ideas all over again from scratch which, by the way, totally sucks when you just CANNOT for the life of you think of a better way to do something simple such as enumerating the different ways in which multiple conditions can be combined together and so you’re left dumping your brains onto the back of a drink-stained Bob Evans placemat over dinner because the aforementioned intellectual property rules prevent you from simply looking back at source code that you shouldn’t even have but hey, it’s burned on the same CD as all your Battlefield 1942 patches that you’re not about to download again because just finding the damn things would be a major pain now that everyone but you turned their backs on that game and ran off to plunk down another $50 for a newer game that will be just as obsolete in two years time, and all the game-deserting rat bastards left you behind with nowhere to re-download said patches for a game that no-one plays anymore, and frankly you probably won’t either unless for some reason you actually DO throw the CD out in which case you’re guaranteed to get a call the next day from your old clan members talking about how they’re "getting the band back together" asking if you still have the patches around, and asking if you could burn a copy for the others since they can’t find the needed patches and they’ve all agreed that they’d all really like to play "that mod that dude made with the cars and stuff". So you’ve kept the CD around, and the old source code that you already know works but you dare not look at because of the same deep-seated superstitions that prevent you from holding onto useful things like old company-logo-imprinted coffee mugs no matter HOW perfectly-shaped they are for holding your pens (recent), or indeed how virtually indestructible they seem when you try to destroy them (old) in some "closure" ritual that you think will somehow purge you of your pent-up superstitions, guilt, and/or homicidal rage for the smug-faced executive tool that just destroyed your family life for the foreseeable future while you search for another gig.

(Note to ex-coworkers, this particular "tool" worked for a company with a three letter acronym involving no A’s or W’s, but a statistically high number of C’s)

And even if you DID sneak a peek at your old source code it wouldn’t do you any good because you realize how far your ideas have come since then, and how inadequate your old architecture was when it comes to implementing your latest brilliant world-domination scheme which coincidentally requires you to implement an ever-so-familiar abstract representation of a query which may or may not end up being translated into SQL for consumption by a relational database, only this time it needs to squeeze its way through a black box full of sharp pokey things known as on ORM layer whose name may or may not start with "N" and end with "Hibernate", all the while knowing full well that if you SHOULD happen to pull the world’s first totally generic, tool-independent query generator out of the lower decks Microsoft will just turn around and release their Entity Framework the next week, rendering everything you’ve done completely obsolete just like they did when they rendered useless all the flashiest, most useful parts of your personal code library the day they released .NET, or like the more recent death-blow that the Enterprise Library gave your validation framework and role-based security architecture, making you question whether you really want to set yourself up for that kind of disappointment by sitting down to redesign and reimplement stuff you’ve done before just so you can watch it get run over by an 18-wheeler with a Microsoft logo on it mere moments after you’ve removed its training wheels, kissed it gently on the head, and told it how proud it makes you.

Wait…what was I talking about?

Oh yeah, repetition. So I’m sitting here working, and find myself face-to-face with something I’ve seen and/or created about a hundred freakin’ times over the course of my career… a class called "Address". Now I swear I’ve solved this problem to death for a myriad of different clients most of which started as small, local companies that swore up and down that they would never, ever be doing business outside their home town and therefore didn’t need to worry about things like Canadian postal codes or country fields and were later, quite predictably, purchased by international companies who actually DID care about such things thereby necessitating a last minute overhaul that you’re called on to perform within a completely unrealistic time frame because the huge data integration push is coming up next monday, and they can’t comprehend that you can’t just flip a magic switch and rebuild their entire application to understand international addressing schemes even though these are the same people who had to make the business decision that it wasn’t worth the hours it would have taken to design the address class correctly in the first place because the budget and/or timeline just wouldn’t tolerate the extra load that they seem to have magically forgotten about now because in their minds all fixes and modifications are trivial. I consider myself lucky this time because this particular Address class I’m looking at today WAS implemented correctly the first time, and CAN handle international addresses. Still though… It seems to me like this is one of those problems that ought to have been solved "Once and for all" by now. There’s a feeling that somewhere in the .NET framework is the Address class to end all Address classes, the one true, golden implementation of THE most common class in all of computerdom and that somehow I’m just not looking in the right namespace for it.

I could start an open source project to pound this particular nail in once and for all. I could implement THE address class, and immortalize my name forever as the developer who finally did it. The developer who finally created the one great reference implementation of the ONE class that EVERY freakin’ project on Earth needs. The all-singing, all-dancing, all-inclusive address class at last. I could… but I guarantee that the .NET framework V.(n+1) would then include a somehow ever-so-slightly-MORE-brilliant version of exactly the same thing, and I’d be left standing on the side of the road holding another pair of freshly-removed training wheels in my hands, staring at a street littered with bicycle detritus, and looking around for the hidden camera.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s