My RESTful Web Services Cookbook has been out for nearly 26 months. From Feb 2010 till the end of 2011, O’Reilly sold 13,052 copies (both print and eBook format combined, per the royalty statements received to date) of this book. Given that O’Reilly’s eBooks are DRM free, I would like to think that several thousands more copies were downloaded for free on torrent sites, but there is no way to know.
Writing this book was a painful exercise. I spent most of 2009 writing the drafts – at that time Yahoo allowed me to spend about 20% of my time for nearly 4 months to write the first draft (for which they own the copyright of the book). It was painful because REST was about style. Not having seen all aspects of the style work in reality, I was not fully convinced about parts of the style. Separating style from protocols was a time consuming yet learning exercise. How could I say that following such and such Roy Fielding’s constraint leads to evolvability without dissecting evolvability into concrete details? The last thing I wanted was to write a book that paints a nice picture with the benefits one would get out of REST without discussing the specifics. I wanted to avoid handwaving at all cost.
In these two years, I changed quite a bit.
- I no longer actively engage myself in discussions about REST.
- I unsubscribed out of rest-discuss in 2011.
- I don’t even subscribe to Roy’s idea that REST APIs must be hypertext-driven or that “A REST API should spend almost all of its descriptive effort in defining the media types”.
What I learned in these two years were the following:
- Don’t confuse styles with protocols.
- Understand what you are going to interoperate with and make tradeoffs as necessary.
- Interoperating between style deviations is more important than arguing for style adherence.
- Interoperability is partly a protocol problem and partly a software problem.
Architecture styles are guides, but protocols specify rules. Roy’s REST codifies (to some extent reverse-engineeres) the Web into a set of constraints. Constaints are what they are – guides sans context. They are subject to tradeoffs. They postulate benefits when applied. But protocols are different. They set ground rules for different systems to work together. Just like you don’t start driving on the left side of the road (in the US), you don’t break TCP or HTTP’s messaging formats. When you break such protocols, you prevent networked systems from working together.
But we tend to mistake the style (i.e, REST) for the protocols. I made that mistake several times (shame on me!) in the past, and I still see it being made. I took care to avoid this while writing the book, but I may not have succeeded fully. Strong belief in a style often leads to zealotry. This is no different from the zealotry we see in socio-political debates.
Yet not all Protocols are the same. I tend to view protocols making up a pyramid. Where a protocol stays in this pyramid shows how widely it helps interoperability.
/\
/ \
/ \
/______\
Towards the bottom are protocols that strive for the widest range of interoperability possible. TCP is an example. HTTP is another example. As you go up the pyramid, the amount of relevance and influence a protocol carries becomes narower. For instance, I would keep RFC 2616 towards the bottom of the pyramid, but an RFC like 5023 (AtomPub) towards the top. AtomPub’s reign of influence was limited then and is even now. I would similarly place a media type like application/json towards the bottom, and a type like application/my-grand-fathers-facebook-profile+json at the top. A perspective of where a protocol belongs in this pyramid certainly helps ration energy.
So, would I write this book differently now? I certainly would.
- I would change the title to something along the lines of “Recipes to Build Client Server Apps Using Web Protocols”, though the editor might ask me to change to include some current trending words.
- I would emphasize even more on protocols.
- I would cut down or clearly demarcate the parts of the book that suggested design styles (such as designing formats).
- I would spend a big chunk on how to interopere without necessarily agreeing on the style.
If you’ve read my book, and built some interoperable Web based systems, you might come to the same conclusion as I did. If that happens, I count my book as a success.
{ 47 comments… read them below or add one }
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
Excellent & thought-provoking posting. I stopped reading rest-discuss about the same time. I’m not sure exactly what happened, whether “religious wrangling” killed REST or whether REST “won” and the wranglings became irrelevant. What I do think in retrospect is this: HTTP was & is an unusually “above the surface” protocol. I can happily build networked systems and know little of how the underlying protocols such as TCP work — as long as I know how to open or read from a socket in my langauge of choice, I’m OK. But HTTP is highly exposed, even for a beginner front-end HTML coder (E.g. POST vs GET on an HTML form). But a mistake was made in that it was treated for a long time as a transport protocol that was better hidden away underneath the “convenience” of first generation web application frameworks. The whole REST movement was largely a (critically important) move to “surface” HTTP and start seeing it as the application protocol that it is. I think that’s where the “design” piece begins — once you embrace the basic pieces of HTTP/REST (thing have names — URIs, we can peform standard methods on those — GET/PUT/POST/DELETE, and hypermedia — links/forms, etc. drives states) there’s plenty more to be figured out (i.e. designed). But I’d contend that accepting/understanding those basics is still a huge win. And concrete examples of designs that take those basics as a foundation are very useful. FWIW, that’s exactly why your RESTful Web Services Cookbook is still my top recommendation for new web application developers.
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
@sallamar explains how he changed and no longer subscribes to the idea that “REST APIs must be hypertext-driven”. – http://t.co/R8ApdAkd
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
Protocols vs Styles http://t.co/clLGYSxP #soa #rest #apparch
Strong belief in a style often leads to zealotry confusing it with the protocol. Thought provoking read. http://t.co/j3ZOVk0d
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
@johnbassil interesting… “@sallamar: On the blog – “Protocols vs Styles” – http://t.co/j2YC8gKE ”
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
Protocols vs Styles http://t.co/hls9ydhh
RT @snoopdave: “I don’t even subscribe to Roy’s idea that REST APIs must be hypertext-driven” | Protocols vs Styles | http://t.co/9zrZVBbY
Protocols vs. Styles: http://t.co/OLxp1KSn
RT @colin_jack: Protocols vs. Styles: http://t.co/OLxp1KSn
RT @olympum: Strong belief in a style often leads to zealotry confusing it with the protocol. Thought provoking read. http://t.co/j3ZOVk0d
Protocols vs Styles http://t.co/yNpjv71u
Ne pas confondre style d’architecture, pe REST, et protocoles http://t.co/Tc7ZI0Yq /via @ChristianFaure
Protocols vs Styles http://t.co/66CelZno great read
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
What would @sallamar do differently if he wrote the “RESTful Web Services Cookbook” now? http://t.co/wGAO19UU #apidesign
RT @sallamar: If you’ve read my http://t.co/dIcUjkcM and come to the same conclusion as I did in http://t.co/DjzLxtif – thanks and mission accomplished.
Protocols vs Styles http://t.co/ImK9iNQ9 #FB
RT @sallamar: If you’ve read my http://t.co/dIcUjkcM and come to the same conclusion as I did in http://t.co/DjzLxtif – thanks and mission accomplished.
Honest and worthy post by @sallamar about REST and the perils of blindly following constraints and guidelines: http://t.co/8GxzkLlF
Protocols vs Styles http://t.co/aSwqoKOu #rest
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
RT @Meligy: Protocols vs Styles: What the author of “RESTful Web Services Cookbook” believed changed since he wrote it! http://t.co/axpfC3e3
RT @hypermediaapis: In which Subbu (Author of the RESTful web services cookbook) basically renounces REST: http://t.co/UK2AAIMq
So, REST is over? RT @hypermediaapis: In which Subbu (Author of RESTful web services cookbook) basically renounces REST http://t.co/U65cPcOA
RT @sallamar: On the blog – “Protocols vs Styles” – http://t.co/DjzLxtif #yam
Protocols vs Styles http://t.co/57wNI3fO
Is there any reason on why you dont subscribe to the idea that “REST api must be Hyperdriven”. I mean any practical difficulties that you had faced when interoperating with other systems.
I don’t subscribe to the “must” part. A style is subject to tradeoffs. There are no “musts”.
Subbu, I see the “must” as giving a “definition” here. If REST is, by definition, to use hypermedia, then not using hypermedia is not REST. If the REST style emphasizes focus on media types, then systems built with little or no thought around media types are not RESTful.
Do you mean that you no more subscribe to the view that all distributed systems must be hypertext driven? That makes sense. But the common problem is that people just don’t understand what they mean when they describe their systems as RESTful, and there, Roy’s rant is justifiable.
Jay – I don’t see strong reasons for all distributed systems to be hypertext-driven. In the overall scheme of things, the value hypertext could add to distributed systems is a tiny fraction. Folks are unfortunately confusing distributed systems with the Web.
I agree. Hypertext is not the only design style. There are many, and you make tradeoffs. What you end up with is often a hybrid style. It is ok if I choose not to use hypertext, but if I build a system with no hypermedia and call it hypertext-driven, then I only am confused.
Great post clarifying the confusion between Protocol and Styles. Look forward to reading more like this from you.
Protocols 和 Styles 要分清楚,想不到 RESTful Web Services Cookbook 這本書的作者,在出版兩年之後,竟然這樣寫了一篇自白…
http://t.co/1lfRa6n9
http://t.co/ct7ssSRu 从《RESTful Web Services Cookbook》作者文章中得知:用1年多时间写成的书,最终只卖出13052本(不知是否仅限于US?),sigh~
@wildjcrt http://t.co/r9Yj5afs