03/21/09 :: [REST] Action, States, ControlleR...? [permalink]

As you may know I have spent a good 18 months trying to debunk some of the biggest BS the RESTafarians have spread on our industry, in particular the "uniform interface" concept. Well yesterday, Tim Bray wrote on "REST Casuistry" .

In his post Tim discusses the "whys" of the Sun Cloud API. Listen to this:

why, to create things, for example a VM in a Cluster, you needed to POST to a special create-vm URI. Why not just POST the representation of the VM to the cluster?

Yes, you heard it right, there are "actions" and they don't even bother modeling them as nouns anymore, thank to a new pattern invented by Tim Bray himself,

Uh, well, because when we cooked up the idea of special purpose “controller” URIs,

Tim, woa, that's news ! You mean the "interface" is not "uniform", boo...

So read my lips, I have said it many times, REST is going to be steamrolled by MVC, this is one of the first sign of it. A "controller", Tim, you must be joking, right? Stefan? Steve?

If that wasn't hilarious enough... Tim continues:

The next argument is about all the other “controller” functions. Deploying a model, starting and stopping and rebooting a machine, attaching networks. The argument is that it’d be more RESTful to have some state fields in the appropriate representations, and just update those fields to the desired new state values.

So...

But you’re not really changing a state, you’re requesting a specific set of actions to happen, as a result of which the state may or may not attain the desired value.

 In fact, when you hit the deploy switch, the state changes to deploying and then after some unpredictable amount of time to deployed. And the reboot operation is the classic case of a box with a big red switch on the side; the problem is how to push the switch.

Really? I mean Really? Hurray, Tim has landed on earth !!!!!!! No surprise that Steve Vinoski is ending his column. How could he not end his column after such a statement (very timely)? Incidentally, it is no surprise that Steve is now going to write on Functional Programming - a programming model that negates the very notion of state. It is encouraging to see people at Microsoft rethinking the programming model with a focus on "domain objects" (not OO).

How many times the RESTafarians swear, hand on the heart -and tongue on the cheek-, that my thinking along the lines of actions and states was complete boloney? John Heintz? (we don't hear you on this topic anymore...) Joe Gregorio? Bill deHora? Steve Vinoski? Where are the RESTafarians? Shouldn't Tim be banished from RESTafaria? or do you still believe that a "client" can "naturally adapt" to any arbitrary change to the set of actions without any changes? 

And Tim, maybe you'll need a contract one day to express all these wonderful actions... and maybe, just maybe, you'll need to version them, possibly in a forward compatible way. You could also think that the latency could suggest a dose of asynchrony? Orchestration anyone? Assembly of Cloud resources?

The (other) REST is just a fallacy, deeply and totally fallacious, Tim.