Daily Archives: 2005/07/06

REST, Oh Oh

Via Tim, a thorougly interesting piece from Benjamin Carlyle on REST and Object Orientation.

If you’ve ever emailed me, you know my address is “distobj@acm.org”, where “distobj” is, of course, short for “distributed object”. So I think it’s fair to say that I’ve given this particular relationship a whole lot of brain-time over the past several years (nine, in fact). I agree with Ben’s presumed hypothesis that there’s a deep relationship here, and he comes very close to nailing it, but falls just short, IMO.

Where I think things go wrong is when he talks about Java Beans;

The real meat in my pie is the use of properties, or as I would call them: Resources.

Nope, properties are properties, resources are the Beans themselves. Imagine a “Person” Bean which might expose the properties; name, birth date, birth city. Now imagine that Bean as a resource, with its own http URI; invoke GET on it and you receive, say, an XML document like this;

<Person>
  <name>Mark Smith</name>
  <birthDate>55</birthDate>
  <birthCity>Bristol</birthCity>
</Person>

So the properties of a Bean represent (at least some of) the state of the Bean, and therefore are returned together in a request for a representation of its state, i.e. GET.

Distributed objects are dead! Long live distributed objects!