July 5 2009
Managing RESTful AJAX operations is an open problem. While I say that aspects of managing HTTP requests, and designing UI feedback cannot be understood in isolation and must be integrated, I still think there are two distinctive and separate issues to consider.
For starters, HTTP has always been stateless, that's it's fundamental form. So in some ways, talking about asynchronous representational state could be pretty meaningless, but it becomes far more interesting when we consider the differences between "pages", "services" and "resources".
The basic concept of the HTTP protocol is of a set of request types - the verbs that act on the nouns representing each resource. The fundamental format of a resource is a page, but practically, it could be anything. In contrast, the concept of a web service is often related to the notion of a remote procedure call, treating HTTP as the way to transmit access an object and return the results of a method, usually without needing to consider the URI as representing an actual resource. Remote procedure calls mostly return generic data structures or a "message", usually in XML format.
In AJAX land where the dominant metaphor of pages is changing towards one of "containers", there are two kinds of requests:
I haven't yet seen much discussion that attempts to separate the distinct issues that arise from these two separate aspects. I think the first of these aspects is pretty well understood - the notion of "only load what you need" is familiar to many developers, but it's the second that interests me the most.
GET and POST are so overused, it's often easy to forget that PUT and DELETE have the potential to be useful too, although I think that the dominant trend has followed a pretty much ineviatable path of least resistance in browsers and server languages, being largely responsible for blocking the potential ascent to a RESTful nirvana.
So what if a web application did expose a full range of structured data through a pure URI format? Whether AJAX or not, this approach changes the notion of a resource from representing a page, or a stream of structured data, towards representing a synthetic object. The cannonical notion of these objects is the noun "item". The noun "page" would be another one of these objects, as would "book", "quote", "note", "event", and so forth.
I'm interested in developing this kind of resource framework at a more fundamental level - a meta-vocabulary for constructing content relationships - although to a greater or lesser extent, all dynamic sites do this anyway. What few sites do however, is expose their vocabulary directly through the URI. I'm starting to see some interesting possibilities.