Ash Moran's Reviews > REST in Practice: Hypermedia and Systems Architecture

REST in Practice by Jim Webber
Rate this book
Clear rating

by
3089816
's review
Jan 02, 12

bookshelves: books-i-read-in-2011, software, software-architecture, web
Read from November 02 to December 31, 2011

I've found this immensely useful for understanding the REST principles that underpin software written for web.

The book starts by describing the levels of the Richardson Maturity Model, from tunnelling RPC calls over HTTP, to full hypermedia systems. There's quite a thorough description of the use of URIs, HTTP methods (GET, POST, PUT etc), media types, conditional requests (eg how to PUT a resource only if its ETag header indicates it has not been modified), and server response codes (far beyond simple 200, 404 and 500s). The REST tools are used to build an online machine-driven coffee ordering system (Restbucks) where the client is led through the business process by hypermedia links generated on the server.

There's a chapter on caching which completely changed my understanding of the subject: rather than being an after-the-fact optimisation, caching is fundamental to the design of HTTP systems, especially to achieve high load with only moderate latency.

The authors then continues to implement parts of the Restbucks system by using the Atom syndication and publication formats. Previously I've only used Atom to subscribe to blog feeds, but the book does a good job of showing its power as a full publishing system, with excellent hypermedia controls. This is also where they introduce the concept of media type composition: embedding one media type inside another. Here, this is embedding documents of type application/vnd.restbucks+xml inside application/atom+xml, which allows a clean separation between the two protocols and concerns. I did wonder at points if they were stretching a little too far the problem domain of Atom to model the specific Restbucks business process, but it serves as a good example of re-using a well-established protocol. The authors favour the re-use of standard protocols as this gives you access to an ecosystem of tools and libraries to inspect the resources. (The broadest example being using XHTML for resources, as then even a human being in a browser can navigate the domain application protocol.)

There's a fairly detailed look at security, using OpenID and OAuth to identify users and authorise access to third party resources. Again, the Restbucks domain is nicely extended with a third party voucher service, and the full protocol for authorisation is worked through.

The only part of the book I thought was of questionable value was on semantics (RDF, OWL etc). There weren't any compelling applications of this nor examples of systems already benefitting from them. That said, it's only a short chapter.

There are liberal code examples. Perhaps because I wasn't working through them while I was reading it, but I often found the code examples too long to follow, and I had to jump backwards and forwards a lot to keep the flow. This isn't helped a lot by the fact some examples are followed by a tedious narrative (especially the early ones) which only serve to repeat what the code said. But then, many other examples have pertinent points clearly highlighted. I'm hesitant to be too critical because creating short but realistic code examples is always hard.

Overall I'm glad I've read this. I found it a bit of an effort to get through, but I've learnt a lot, and I'll certainly be referring to this as I try to implement better web systems. The real test will be how much of the book I consider invaluable in a year's time. I highly recommended to this to any web developer, as it has either changed or massively clarified many of the things I thought I knew about the machine web.
likeflag

Sign into Goodreads to see if any of your friends have read REST in Practice.
sign in »

No comments have been added yet.