My Revised REST Talk at OOP 2012
Last week I attended and have spoken at OOP 2012 in Munich. It was overall great experience and unfortunately, as at each top conference, I often had hard times deciding which session to attend. I learned a lot from thought leaders like Johanna Rothman, Diana Larsen, David J Anderson, Jurgen Appelo, Matthias Bohlen, Stefan Tilkov and many more and probably missed some really great sessions and discussions as well. I also used the chance and met my friends in Munich – it was a great time.
My session was titled “REST: you’re doing it wrong” or “REST, du machst das falsch” in German. It was a significantly revised version of the talk I gave at NRWConf 2011 in Wuppertal. This time I enhanced the story a little bit as well as overhauled the whole presentation. I used imress.js framework to create an HTML5 presentation to be shown in browser – no special slideware needed. I very much like the result, though I gathered somewhat mixed experience achieving it. It was particularly troublesome to arrange all the presentation steps on the canvas while working in pixel units. Maybe some layout plugin or template language would help. The presentation also doesn’t work well in all browsers. From the presenter’s standpoint it ok: it works smoothly in Safari on a Mac, but for publishing online it’s a major drawback: Chrome on a Mac has performance and rendering issues while current stable Firefox is not supported altogether. Anyway these issues will be ironed out sooner or later and I’ll probably stay away of any PowerPoint-inspired slideware from now on.
I started the talk with the ironic tale of the ice-cream maker written by Sebastien Lambla. After that I continued with fundamental architectural decisions made by the creators of the Web and upon which REST as an architectural style is based.
Then I moved to common misinterpretation of REST, like claiming that not using SOAP or using JSON for serialization is already RESTful. After that I introduced Richardson REST Maturity Model and started moving the story towards a RESTful system.
First, I talked about resources and their identifiers. It was also important to mention the distinction between resources and representations. It was then obvious that using URI is inappropriate way of specifying a representation (like the API version or language being part of the URI).
I then mentioned the importance of understanding HTTP mechanisms and assumptions it makes against different methods. The most common pitfall in RESTful systems design is from my perspective to stop on that stage and build a CRUD (Create Read Update Delete) service. Though CRUD certainly has its application domain, nonetheless it’s inappropriate for most of the business systems, as the application logic remains outside of the application – like an Excel spreadsheet, where the user just edits raw data instead of fulfilling business tasks.
The natural step from a system designed out of HTTP methods is a system designed out of resources, where each business task is a resource. This is almost the same principle we use for ages building web applications. Such a system can leverage well-known mechanics of hyperlinks and forms to provide a truly RESTful API.
Update: There is also a ~5.8 megapixel poster of the overview slide in PNG format if the impress.js version doesn’t happen to work for you.