Since our kids were born years ago, my wife has generally been pretty Organic crazy. The Organic food movement was created so that we don’t “poison” our bodies with food grown and treated with harmful pesticides and chemicals, that don’t introduce dangerous genetically modified seeds or growth hormones, and finally, contribute generally to society as a whole by promoting sustainable farming that doesn’t deplete or damage the environment.
From Movement to Certification
Organic food and farming started out as a movement, but quickly turned into a branding and certification effort. Many farmers and companies found that following strict organic principles was expensive and added to the cost of the goods they produced. While many customers were willing to pay the extra cost involved to avoid “poisoning” their bodies, still many others are more interested in saving money now and worrying about the long term consequences to their bodies and environment later down the road. So, some companies would avoid pesticides, but still use genetically modified seeds, and call their products organic. Or milk companies wouldn’t use growth hormones, but still use non-organic feeds for their livestock, and still call their products organic.
To fight this pollution and misrepresentation of organic principles a branding and certification effort was introduced so that each product on the market could be officially approved as organic or not. Organic food customers would know what to expect from a product by seeing this brand on their packaging. If you wanted to sell organic products, you’d have to be officially certified and inspected by a third party.
Is REST following Organic’s path?
Roy Fielding, the father of REST, has the same expectations that organic food consumers have. When something is deemed RESTful he has certain expectations that have to be 100% fulfilled. Its very understandable as Roy deals with Web standards, they have to scale, their going to be used by millions. The stability and usability of the Web are too important to propagate flawed protocols. Roy says in his PhD:
While mismatches [to REST] cannot be avoided in general, it is possible to identify them before they become standardized.
So, maybe Roy should trademark REST, brand REST, and promote the creation of an official organization that can bless an application or API as RESTful much like we have an Organically Certified label. Let’s do a tiny thought exercise on this…
One of the consequences of heading down this route is that REST evangelists will lose the Web as their prime example of REST in action. While the HTML and HTTP standards and specifications will be a great example of REST in action, most of the applications on the Web don’t follow the strict criteria of REST (a static web page is not an application). As Roy states, its hard to avoid mismatches in the RESTful style, even if you try. This is especially true if you’re building a distributed interface for a legacy system. The rest of us will lose a lot of language and vocabulary to describe our apps if REST is branded/certified.
Well…You may be laughing (or fuming) about the idea of branding and certifying REST. The thing is though, often, when you interact with the REST community you get condescending comments like:
Then do not call it REST. It is that simple. And saying that some academic has not written a line of code detracts from what you are saying. REST has a clear enough definition. XXXX (insert whatever here) is not RESTful, so don’t call it so!!
You get this sort of interaction when a thought, API, or interface breaks or bends a RESTful principle AND you want to still use REST to name and/or describe your thing. Reactions like this is very akin to treating REST as a certified brand rather than a style.
Expectations are just not the same
The thing is though, the expectations of IANA, W3C, and people Roy Fielding are very different than the average application developer. There’s really two main reasons why a developer initially is attracted to REST:
- Simplicity. You can use a RESTful interface without having to define a WSDL document, generate stubs, and download (or pay for) some complex middleware stack or library just to implement a “Hello World” example.
- “Lightweight” interoperability. Because HTTP is everywhere, if you write a RESTful interface, it should be usable in most languages and platforms without much effort (i.e. iphone, android, python, Ruby, Java, Perl, etc…)
Sure, there are a lot of other goodies you get when you learn more about REST architectural guidelines and start applying them, but these two reasons, IMO, are the reason app-developers initially look into REST. W3C, IANA, etc. have different expectations, though, as they are defining standards that the Web will be built upon. A screwup here can have a much more far reaching affects on things compared to messing up an application that can usually be refactored over time. The domain REST is going to be applied to should have a direct correlation on how critical we should be of the interface.
Focus on benefits and consequences instead of definition
While strictly following REST works for Web standards, its just not always feasible to follow them religiously in everyday applications. After all, REST is a style and set of guidelines, not a set of laws or, gasp, a branded certified trademark. Instead, people should be allowed to use REST to name and describe themselves without harassment. Instead, critics should focus on the consequences of a specific app or API not following a specific RESTful constraint and the benefits if they did modify the interface to follow the guideline.
I think we’ve all had negative experiences with trying to follow an architectural principle (REST, OOP, or whatever) religiously. I think most of us realize that focusing on delivery to market through multiple iterations and user requirements and feedback is much more important than whether we religiously follow a specific guideline. The easy answer is “Then don’t call it REST!”, but we’d have a very limited vocabulary in software engineering if this mantra was followed with every new architectural style that was created.
Jan 27, 2011 @ 21:30:11
Here, here.
Jan 28, 2011 @ 02:44:37
Not totally on topic, but did you see Food Inc? Scary stuff… Makes me want to become a veggie-hippy!
Jan 28, 2011 @ 14:35:05
Nope, I prefer to spend my free time playing WoW, poker, or reading trashy SF/Fantasy novels.
Jan 28, 2011 @ 12:22:25
What do you actually mean by “RESTful interface”? Wouldn’t it actually be clearer to use the term “HTTP interface”?
Also; you’re right an individual web page (i.e. HTML dereferenced via a URL) isn’t an application – it’s a representation of state.
But.. what is happening when a user goes to google, searches for something, browses through several web pages to find an answer or complete a task – which could well include the page in question – that _is_ an application. Equally, when a crawler is crawling through pages – that’s an application too. Or when a user is going from the home page of your shop, to a product page, to the basket, to checkout, and completes their payment – that is an application. The fact that an html page isn’t an application and yet _many_ applications/behaviour patterns (have and continue to) emerge and adapt over time thanks to html and the web browser is testament to the idea of hypermedia as the engine of application state and the hypermedia constraint, and highlights a key part of how RESTful systems achieve evolvability.
Cheers,
Mike
Jan 28, 2011 @ 14:32:11
>What do you actually mean by “RESTful interface”? Wouldn’t it actually be clearer to use the term “HTTP interface”?
No, because often times, (as I keep repeating myself), you end up relaxing a constraint to keep your interface simple, or just because you’re building on top of a legacy system. I’ve has to do this before with the stateless constraint. REST is an end goal and conveys the general architecture of your interface.
It takes awhile to fully grasp the finer points of REST and to apply them correctly to your app (i’m still in this camp). I don’t think one should be barred from using REST terminology just because of this. It is very discouraging being a beginner and being scolded on how much of an idiot you are, or even worse, chastised when you know what you’re doing, but are more concerned about providing nice interfaces for your users to consume than being architecturally pure. Its much more constructive to point out how something like HATEOAS could improve somebody’s interface than to scold them and to say they can’t join the REST club.
To your other points, Google is the application, not the documents it searches. Thats like saying data in a relational DB is an application. Google (and web crawlers in general) is not a good example as it is only one app, compared to the hundreds of thousands of other apps out there. Also, these “shopping cart” applications you talk about are not purely RESTful, I guarantee that 99.99% of them store client state within an HTTP session. In fact, I’ll be as bold to state that Web applications are becoming less and less RESTful as the years go by.
Scott Banwart's Blog » Blog Archive » Distributed Weekly 87
Jan 28, 2011 @ 14:47:10
This Week in #REST – Volume 32 (Jan 8 2011 – Jan 28 2011) « This week in REST
Jan 29, 2011 @ 21:20:03