Maybe I need some more REST
This post isn’t about sleep deprevation. Instead, the witty title is referring to everyone’s newest, favouritist buzzword: REST (or Representational State Transfer).
Scene setting with some things that have happened recently (in roughly this order):
- Ben mentions that we need to think about splitting our application up to better distribute the load on servers. I don’t completely ‘get it’.
- Rails gets REST support baked in (Ok, so this is pretty old news now)
- We spent quite a lot of time at work writing code to access the google adwords soap api
- I finally got (thanks to James) why some rails folk have stated that following a RESTful design frees them up from having namespaced admin controllers.
- I spent quite a bit of time over the last two weeks really looking into the atom syndication format and atom publishing protocol
- I spent a few hours at the weekend playing with the amazon s3 service
- This popped up recently and got an incredible amount of attention.
- I read an interview with Werner Vogel (CTO of Amazon) that talks about everything being a service. One quote in particular caught my attention.
If you hit the Amazon.com gateway page, the application calls more than 100 services to collect data and construct the page for you.
- I took the plunge and just about stayed awake through The Document. I found chapter 6 (and in particular 6.3.4) the most relevant as it explains REST in the context of the URI and HTTP. I tend to drift off on when things are explained without real examples.
- I watched Geoffrey Grosenbach’s peepcode screencast on restful rails.
- I worked out how to use del.icio.us and subscribed to some of the tags (keywords) mentioned above.
Wow. You’d think with all that reading, listening and viewing I’d be right up on the subject. Sadly I don’t feel as though that’s quite the case.
Now. I do see an advantage of a RESTful approach (particular the style currently advocated in rails), over SOAP, when dealing with something like the google adwords api1. But, what about services like currency conversion and syntax highlighting? I can’t get these to fit into a RESTful style in my head (I guess I can’t find the resource in each case). Instead, I see them as analogous to unix command line applications: pipe simple data in (an amount with two curencies or ruby code) and get simple data out (an amount in the new currency or syntax-highlighted ruby code). Actually, I see them as remote procedure calls. Are these types of services incompatible with the REST architectural style or have I missed something? I’m starting to wonder if I’m getting too hung up on REST = CRUD and therefore missing some of the more fundamental points. Either way, I definitely feel that it’d be good to see some more concrete examples in the REST vs SOAP/RPC/SOA arguments. As stated above, I’m not so great in the abstract.
1 I had a few problems when interacting with the adwords api. I don’t, however, feel that I have enough information to know whether the pain was caused by soap4r, soap, the api or just my lack of knowledge.