[erlang-questions] YAWS RESTful examples

Alain O'Dea alain.odea@REDACTED
Mon Feb 7 18:14:26 CET 2011


On 2011-02-07, at 13:23, Steve Vinoski <vinoski@REDACTED> wrote:

> On Sun, Feb 6, 2011 at 10:32 AM, Alain O'Dea <alain.odea@REDACTED> wrote:
>> Hi David:
>> 
>> I totally agree with Lukas.  I could bot make heads or tails of REST on YAWS.  It seemed like a square peg in a round hole.
> 
> No offense, but I don't think this statement makes much sense because
> it implies that writing RESTful applications with Yaws is impossible,
> which most definitely is not the case:
> 
> http://www.infoq.com/articles/vinoski-erlang-rest

Wait a second, I was not claiming that nor did I intend to imply that YAWS is incapable of REST.  I found YAWS required more conditional code for HTTP lifecycle issues that Webmachine encapsulates.  I found YAWS to be awkward for building RESTful interfaces.

> The nice thing that Webmachine does for you is encode the rules of the
> HTTP application protocol, thereby making it hard for your app to get
> those wrong, but that by itself is still not enough to guarantee
> RESTfulness. Only the application itself, regardless of underlying
> framework or web server, can determine RESTfulness.

It does help a lot though :)

> For example, one of the most important constraints of the REST
> architectural style is "hypermedia as the engine of application
> state," which means for each request, the server uses hypermedia to
> direct each client application (user agent) to possible next steps
> given what it just requested. Many apps claiming to be RESTful fail
> miserably on this critical constraint, and thus are not actually
> RESTful, because they don't use a standard media type that supports
> links (or use Link headers) -- they instead use custom media types
> based on JSON or XML that require the client to be specifically
> coupled to the server so it can interpret the custom media type. In my
> InfoQ article linked above from 2008 I failed to give this critical
> constraint the focus it requires.

The HATEOAS point is hugely important.  I have failed at this in Scrumjet and it definitely leads to coupling.


More information about the erlang-questions mailing list