In favor of special-purpose

I used to think that general-purpose technologies would evolve and eventually become superior to their special-purpose counterparts.

Take XSLT for example: Somewhere, sometime, I think I heard that the .NET Framework’s XSLT implementation could generate an in-memory assembly from an XSL transform, that was fully compiled IL code. Given enough optimization, a solution like that should be able to out-perform any manual transformation using XPath and a StringBuilder.

I have since given up that idea.

I don’t think the power of general-purpose technologies is in their ability to solve every problem the best possible way. Rather that they make it possible to data-drive otherwise typically programmatic scenarios, which lends itself well to plugin behavior without compiled code.

Continuing with the XSLT example, consider how relatively easy it is to allow your code to transform an XML document using a user-provided XSL stylesheet, rather than having them implement a separate assembly that you can load dynamically and execute code from.

This is all well, but the reason I bring this up is: unless you need that level of pluggability, hand-crafted code will probably be both faster and easier to maintain and test.

General-purpose technologies such as SQL and XML sometimes seem so prevalent that using them just seems natural. But sometimes, maybe it’s better to use alternative technologies or, for that matter, roll your own.

I’ve been lured into the web (no, not the web) of general-purpose stuff too many times without proper evaluation, that I need this as a reminder for myself:

Never introduce a dependency on a general-purpose technology until there is no way around it.

This is neither politically correct nor an accepted best-practice, so when in doubt, it’s probably safer to disagree with me.


Any comments?

I’ve just added comments via the excellent Haloscan, so if anybody’s actually reading this, you may want to announce your presence.

Here’s to hoping it works!

Update: As I’ve now moved my blog over to WordPress, Haloscan is out of the picture, but I thought I’d keep the endorsement.

Dear diary

We spent the weekend in London with my 15-year-old brother-in-law, and had a blast.

Like him, I’d never been to London properly, so it was fun for me to walk around all the neighborhoods getting a feel for the city. It’s just hard getting used to everybody driving on the wrong side of the street.

While there, I finished The Brooklyn Follies — a must-read if you like Paul Auster.

At work, we’re scrubbing requirements for a new project. I might get into details later. It’s difficult at times, but we’re still moving forward.

In half an hour I’m going to my first Wushu exercise for the autumn, so I expect great pains tomorrow. Looking forward to getting back in shape, though, summer has been very fruitful for my belly.