22 May 2009

You want that wrapped or just in a bag?

Kevin Marks' blogged a year ago in An API is a bespoke suit, a standard is a t-shirt, that the problem with an API is that it:
is like being a bespoke tailor - you have to measure them carefully, and cut your code exactly right to fit in with their shapes, and the effort is the same for every site you have to deal with (you get more skilled at it over time, but it is a craft nonetheless). (1)
Alternately, he sees Standards, like HTML5, OpenID, OAuth or OpenSocial, to be like "like designing a t-shirt".
when a site adopts a standard format for expressing their data, or how to interact with it, you can put your code together once, try it out on some conformance tests, and be sure it will work across a wide range of different sites. (2)
Today he Tweeted that he wanted to know if this metaphor made sense. I thought I would do a @ back, but then thought that this deserved more discussion. So here is a bit of a response to Kevin (albeit unsolicited).

It is true that APIs are "tailored" in the sense that Kevin Marks says, and this is a major drawback. However, there are further problems with standards that far outstretch this tailored inconvenience.

First of all, Standard APIs simply move the tailoring from the API to the wrapper. Fine, you no longer have to tailor your code to all those APIs, but every publisher has to tailor a wrapper.

Second, why do we think that tailoring is such a bad thing? The assumption here, and I hope I am not reading too much into Kevin Marks' statements, is that what we want is nice simple and standardised information. Well, the whole social web thing seems to disprove this. The power of the web is in the diversity, complexity and, yes, even the messiness.

To push this metaphor in a different direction, the problem is that all we seem to be able to find in the shops now are racks and racks of sub-standard (pardon the pun) t-Shirts. What we really would like are some choices, not racks of the same things, no matter how many amusing slogans are printed onto them.

If I could push the metaphor in yet another direction, t-shirts, no matter how convenient, simple and comfortable, are simply not appropriate attire for many social settings. I do not simply mean here that we should not wear t-shirts to weddings or the opera (this is admittedly a matter of debate), but that for many cultures t-shirts are not acceptable attire period. Are we all expected to dress, or share and transform API data, in the same way?

The problems with standards in general, and such content transforming standards in particular, is that they have to take a single view of the world for granted. This may be conceptually trivial as in cases of transport standards such as TCP/IP where its world is the world of distributed servers. But the Web is not a world of information, but is a world of discussion, translation, use, sharing, conversation, performance, selling, etc., etc., etc.

Kevin Marks is right that APIs also over determine what they see as useful in their data. In part, I don't see this as a necessarily bad thing as each API reflects a context for the information as well as the information. However, a far more simple solution, than the mass produced t-shirt, would be something like Jeff Lindsay's webhooks. Rather than a commodity metaphor, Jeff's webhooks are more like recycling. Rather than sending out racks of t-shirts, webhooks would be more like this:
"Here is some old plastic that we collected."
"Ok, crunch it up and send it over."
"What are you going to do with it?"
"That's none of your business. However, we are going to transform it into a whole new set of things."
Mass production or sustainability. I suppose that is the question. Is it better to take our information and let people re-use it, in whole new ways, or to broadcast out our information in increasingly narrow channels? I would chose the former in both cases.

No comments:

Post a Comment