Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1
185

Chapter 7 CHAPTER 7


REST, Resources, and Web Services 7


There are only two hard things in Computer Science:
cache invalidation and naming things.
—Phil Karlton

The architectural principles of Representational State Transfer, or REST, have been
taking the Rails world by storm. The idea behind REST has been around since Roy
Fielding first described it in his 2000 doctoral dissertation. However, the ideas have only
started to gain traction among Rails developers since David Heinemeier Hansson’spre-
sentation of those ideas in 2006 and the subsequent adoption of RESTful principles
in Rails 1.2. RESTful design is a new way of thinking about network architecture
based on an observation of how the Web works.


What Is REST?


In short, REST is a unifying theory for how “distributed hypermedia” systems (pri-
marily, the World Wide Web) are best organized and structured. The term was
coined by Roy Fielding, coauthor of the HTT Pspecification, in his 2000 doctoral dis-
sertationArchitectural Styles and the Design of Network-Based Software Architectures.*
The dissertation extracts a set of principles that are common to network architec-
tures, based on an examination of the structure of the Web and the HTT Pprotocol.
Starting with the “null style,” which is the absence of constraints on architecture,
Fielding arrives at REST by placing a series of constraints on network architecture:


Client-Server
The client-server constraint imposes a separation of data storage from user inter-
face and presentation. The most important benefit of this separation is that cli-
ent and server can exist in separate organizations and be maintained, developed,
and scaled independently.



  • Available fromhttp://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm.

Free download pdf