Tuesday, December 12, 2006

The Dichotomy of Good and Evil

...err I mean Interoperability and Performance.

It recently occured to me that it is an almost universal truth that interoperability and performance are mutually opposed, or, a Dichotomy. I have been working with web services quite a lot lately, and they really hammer this point home: they are incredibly interoperable, but their performance is deplorable.

Imagine, if you will, a web-service which allows you to retrieve documents from some sort of repository of documents. The web service connects a client application (perhaps integrated into the shell of the operating system), so naturally there will be a bit of to-and-fro between the client and the server. That doesn't seem so bad, does it? Lets take a look at the underlying technology of web services today, SOAP.

SOAP, or Simple Object Access Protocol, is in essence a middleware technology: it masks heterogeneity amongst networked systems. How does it do this? Everything, I mean absolutely everything, is transmitted via http, marked up as, you guessed it...XML. Now in terms of interoperability this is excellent: a machine-(even human)-readable format that is completely abstract of any underlying system. The semantics of one xml message can be defined by yet another xml message, marvelous. But wait, doesn't that mean we're converting all of our data to a string representation and padding it with heaps of markup? Yes. Doesn't that mean we have to employ loads of parsing and writing functionality to read/generate the messages? Yes. So, in terms of performance, we have one massive load of overhead? Yes.

So you see, web services are great from the perspective of ease of use and interoperability, but they are heavy with what I like to call transport information: information that is not needed by either end-process, but it is needed in order to get the useful information from end to end.

How about another example of this great Dichotomy? Java vs C. Java is platform independant and apps written in Java can be run anywhere (provided you have the requisite run-time environment), they can have a standard look and feel accross all platforms, or they can imitate their host system, and it has a brilliant framework which allows you to do a heck of a lot without too much effort; but, the JRE is a large install at the best of times, JVM's have a significant footprint and there is a high level of general bloat even for tiny tool. Programs written in C, on the other hand, are specific to the platform they are compiled in and as such require a fair amount of extra effort to port from platform to platform. It is incredibly difficult to create a standard UI accross platforms unless you use something like GTK+ (which gets nasty in places like OSX), but if you want to write a highly optimized tool that only needs to run on one platform you wouldn't choose anything else.

So back to the intial idea, that Performance and Interoperability are mutually exclusive, you know I'm right, but in terms of the title - I'll let you choose which is Good and which is Evil.

No comments: