Safety, Idempotence, and the Resource-Oriented Architecture - That’s It!
(Page 5 of 5 )
That’s the Resource-Oriented Architecture. It’s just four concepts:
- Resources
- Their names (URIs)
- Their representations
- The links between them
and four properties:
- Addressability
- Statelessness
- Connectedness
- A uniform interface
Of course, there are still a lot of open questions. How should a real data set be split into resources, and how should the resources be laid out? What should go into the actual HTTP requests and responses? I’m going to spend much of the rest of the book exploring issues like these.
* The earliest instance of “resource-oriented” I’ve found is a 2004 IBM developerWorks article by James Snell: “Resource-oriented vs. activity-oriented Web services” (http://www128.ibm.com/developerworks/xml/
library/ws-restvsoap/). Alex Bunardzic used “Resource-Oriented Architecture” in August 2006, before this book was announced: http://jooto.com/blog/index.php/2006/08/08/replacing-service-oriented-architecture-with-
resource-oriented-architecture/. I don’t agree with everything in those articles, but I do acknowledge their priority in terminology.
† “The Architecture of the World Wide Web” (http://www.w3.org/TR/2004/REC-webarch-20041215/#p39), which is full of good quotes, incidentally: “Software developers should expect that sharing URIs across applications will be useful, even if that utility is not initially evident.” This could be the battle cry of the ROA.
‡ Compare the Ajax interface against the more addressable version of Gmail you get by starting off at the URI
https://mail.google.com/mail/?ui=html. If you use this plain HTML interface, the resource “email messages about jellyfish” is addressable.
§ Other consumers of this web service include the libgmail library for Python (http://libgmail.sourceforge.net/).
‖ This idea is based on the CMU Coke machine (http://www.cs.cmu.edu/%7Ecoke/), which for many years was observed by instruments and whose current state was accessible through the Finger protocol. The machine is still around, though at the time of writing its state was not accessible online.
#Multiplying a number by one is both safe and idempotent: 4 ×1 ×1 ×1 is the same as 4 ×1, which is the same as 4. Multiplication by zero is not safe, because 4 ×0 is not the same as 4. Multiplying by any other number
is neither safe nor idempotent.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
|
This article is excerpted from chapter four of the book RESTful Web Services, written by Leonard Richardson and Sam Ruby (O'Reilly, 2008; ISBN: 0596529260). Check it out today at your favorite bookstore. Buy this book now.
|
|