Give it a REST…


Give it a REST…

REST is the REpresentational State Transfer coined by Roy Fielding in his dissertation. He basically reverse-engineered the web architecture and spelled it out.

I have been reading about REST on this website and found it to be interesting but little more than a reverse-engineered justification for building ad-hoc systems that I would call “hacks”. Basically, the argument goes, all of these web systems work so well together because they have such a low level of coordination. My take on this is that they work so well because you have a human sitting behind them reading the page and making choices based on what the page says. If you look at their examples of how to convert an RPC system into a REST system you basically just pick a bunch of URIs to GET/POST/PUT/DELETE to and then write against this API whose only documentation consists of human readable descriptions on how to use them. No compile-time checking, no code-level interfaces, really nothing but a hopeful description on what might happen. This is OK when a person is sitting there making a decision about what to do next or what to do about an error that they get, but this is absolutely not OK when you are writing software.

One might argue that is just the way SMTP/POP/HTTP/etc. works! And then I would point out that there isn’t even a way in SMTP/POP to find out if the mail went through properly without a human reading an email message and that in HTTP people don’t even really use the verbs PUT/DELETE and that POST is used almost exclusively for submitting forms that were — — tada — — filled out by humans. 

If you want to write a nice hack and get something done quickly why worry about any of this protocol crap, just read and write to sockets in whatever format is popular that day.