Home arrow Web Services arrow Page 5 - Safety, Idempotence, and the Resource-Oriented Architecture

Safety, Idempotence, and the Resource-Oriented Architecture

In this conclusion to a four-part series on the resource-oriented architecture, you will learn (among other things) about safety and idempotence, and why they matter. 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). Copyright © 2008 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
February 20, 2009
  1. · Safety, Idempotence, and the Resource-Oriented Architecture
  2. · Safety and Idempotence
  3. · Why safety and idempotence matter
  4. · Why the Uniform Interface Matters
  5. · That’s It!

print this article

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:

  1. Resources
  2. Their names (URIs)
  3. Their representations
  4. The links between them

and four properties:

  1. Addressability
  2. Statelessness
  3. Connectedness
  4. 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
. 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.

blog comments powered by Disqus

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials