July 06, 2005

Carlyle's Sound Advice and REST

Benjamin Carlyle has this to say when comparing object-oriented programming with REST architctural style:
"On the other hand REST says that the set of operations you can perform on resources should be almost completely uniform. Instead of defining new operations, REST emphasises the creation and naming of new resources. As well as limiting verbs, REST seeks to reduce the number of content types in play. You can picture REST as a triangle with its three vertices labelled 'nouns', 'verbs', and 'content types'. REST seeks to push the balance well away from both verbs and content types, as close as possible to the nouns vertex. "


This is not accurate - REST actually drives toward increasing content-types. Not necessarily maximizing, but definitely opening up the space of possibilities. So I would say that REST seeks to push the balance away from verbs and as close to the edge of nouns and content-types.

Also this:
"REST says that the namespace should be king. Every object that should be contactable by another object should have a name. Not just any name, but a globally-accessable one. If you push this to the extreme, every object that should be accessable from another object should be also accessable from any place in the world by a single globally-unique identifier. [...] REST provides each abstraction through its heirarchical namespace rather than trying to hide the namespace. Since all accessable objects participate in this single interface, the line between those objects blurs."


This definitely is key to the REST architecture. However, REST does not have a heirarchical namespace. Neither does HTTP. They only have identifiers that are opaque to the client. Also, since resource have a single interface, the line between these objects isn't so much 'blurred' as it is unnecessary.

No comments: