i don't know who invented the REST triangle
, but in my opinion it deserves some prize for an utterly useless visualization. in my experience, REST beginners are either just confused by it, or, even worse, they try to rationalize it, assuming that the shape and/or the edges must have some semantics. which they don't. so while the REST lecture of my fall 2007 web architecture course did contain the REST triangle, the fall 2008 version will not use it anymore.
but when thinking about how to best explain REST (and coming to the conclusion that the triangle is not useful at all), i thought about possible similarities between REST and natural language. the following thoughts are still pretty rough, but there is something to them that makes me want to explore that direction further.
REST is about having a broad vocabulary of nouns (URIs), these are the resources you can talk about. you make up a URI, and then you can talk about a resource. then there is a much smaller set of representations (content types) which give you the ability to represent something (i.e., to exchange descriptions of resources). by mapping resources to representations, you can use different representations for the same resource (HTML and PDF for a document). finally, there is an even smaller set of verbs, basically the four verbs of HTTP (GET, PUT, POST, DELETE), which let you interact with resources by exchanging representations. depending on what kind of descriptive power you support in your representations, you can interact with resources in different ways.
natural language has few verbs, many more adjectives and adverbs, and can talk about an infinite number of things by using nouns and names. that's the power of language. REST seems very similar to me. why is natural language this way, is this the best (or maybe even only reasonable) way how to have a language that can deal with anything in an open world? are there natural languages that are similar to APIs? to me, REST makes much more sense than the API-centric SOAP world, which hides everything behind interfaces and you can never talk about things, you can only use specifically designed functions for a certain class of things to interact with it.
as i said, these thoughts are pretty rough and i definitely do lack linguistic background here. but it seems to me that comparing REST to natural language could be not only an entertaining, but also a worthwhile exercise. now this might be a bit far-fetched, but i could imagine coming up with thoughts such as REST being the better concept for an open world, whereas SOAP and the WS-* crowd maybe better suited for a closed world where everything is decided by a central entity, and therefore information hiding is good. that's another thing i still have to understand better: i have learned so much about information hiding and encapsulation and all these things from the OO days, and it is still something that is very dominant in my thinking. however, i think when making the move to an open and loosely coupled world and something like REST, these concepts somehow don't work so well anymore. is that because they have been developed for software engineering in closed systems with top-down design as the only method?
I agree that the triangle is useless -- I don't know where it came from or why it persists in spite of the lack of authority. I should probably get a wikipedia account and fix the misinformation once and for all.
In regards to language, however, we have been using that analogy for a long time (hence, "nouns" and "verbs"). I gave a presentation at WebNet`99 about REST in terms of a metaphor for human communication. Unfortunately, I can't post the slides because I used some images as example representations and forgot to track the copyrights.
Posted by: Roy T. Fielding | Tuesday, April 15, 2008 at 18:28
roy, thanks a lot for your comment! i definitely did not want to create the impression that i came up with idea of talking about "nouns" and "verbs". all i wanted to talk about was the question of whether the particular richness and extensibility of natural language is based on that general pattern of a natural language structuring communications into names and nouns and verbs. but as i said, my linguistic skills are so bad that i don't even know whether this actually is a pretty common pattern for natural languages, or whether there are radically different natural languages, maybe even some with a more "API-like" language structure. i would be very interested to learn more about this, though...
Posted by: dret | Tuesday, April 15, 2008 at 19:02