Thursday, July 17, 2008

Behavior and Rest

So here's an interesting angle (from someone that seems pretty intelligent) concerning one of my main disappointments in the 'rest' approach to web services. That is, the rest approach only encapsulates five possible behaviors (corresponding to the five HTTP verbs). In my mind, any other behavior encapsulation doesn't fit in the rest model. This guy disagrees...and he does so fairly eloquently....

Unfortunately, this doesn't cut it for me - because, you're still not encapsulating any new behavior - your factoring it out into its crud operations, and then doing the behavior in the client code. So - it appears to me that rest is just not really suited to situations where you're actually trying to encapsulate behavior (such as non-trivial business logic)... but it is VERY nice for quickly modeling things that can be thought of as a resource or as a piece of data, that you want to be able to view or modify in a sort of low-level kind of way....this resource-centric approach is probably the best part of rest and would probably fit in well with other modes of web service delivery - but because of this short-coming - probably not a suitable least IMHO. :)

1 comment:

Kevin Fleming said...

I agree. I have always seen REST as simply CRUD operations. When you boil it all down, it's about the exercise of designing the appropriate objects to do CRUD against. The problem I see, as soon as you create such specialized objects to fit the REST/CRUD paradigm, you really might as well be using RPC because your objects are so devoted to a specific task they really loose their "generalization" that makes REST appealing to me.