Why I think AJAX breaks REST continued

There were some really good comments on my “Why I think AJAX breaks REST” post to which I tried to reply. The reason for this new post was Andrew Newman‘s comments.

I disagree with Andrew on his assertion that REST is only about how services should be exposed. I think that REST is an architectural style on how to write distributed applications, not just services. It sets the principles of RESTful applications and defines the interaction constraints that should be applied in order to maintain those principles. This is the first sentence of Roy Fielding’s chapter 5:

“This chapter introduces and elaborates the Representational State Transfer (REST) architectural style for distributed hypermedia systems, describing the software engineering principles guiding REST and the interaction constraints chosen to retain those principles, while contrasting them to the constraints of other architectural styles”

Please also note that REST is an architectural style for a hypermedia application. In a hypermedia application, when one follows a link the result is a transfer to a different state. Also note that one of the constraints is that state is identified by URIs.

I do agree that AJAX is a way to write client-side code. I don’t think I supported otherwise.

What I did say is that the use of the AJAX approach to building distributed applications, or even just client-side ones, encourages a move away from the REST principles and that those building distributed applications should be aware of that. Of course, if any approach (REST or non-REST) results in well-architected, good, scalable solutions offering high-value then I don’t see why we shouldn’t use it. We just can’t call all the good things out there RESTful.

One response to “Why I think AJAX breaks REST continued”

  1. Can I suggest to you an alternative terminology? I have been starting to revive RestWiki, especially the early parts of the FAQ[1]. Perhaps you would be interested in my view of the criteria for REST, and especially the REST subset I’m calling “User REST”. Comments are appreciated.

    [1] http://rest.blueoxen.net/cgi-bin/wiki.pl?RestFaq