Speech Acts, REST and Method Classification
|
|
Roy Fielding now Chief Scientist for www.day.com , (apparently the same guys who wrote the free JSP debugger) wrote an interesting dissertation about the architecture of the Web. He coined the notion of REST architectural style . REST is a style that uses a small set of verbs (GET, PUT, POST, DELETE) and possibly an infinite set of nouns. The web gains benefits in interoperability and scalability in that it uses the REST architecture.
Now, I've seen this concept before in Agent Research, in particular KQML exploited a model of human communication called speech acts. The set of verbs were tell, deny, untell, insert, delete, errror, sorry, evaluate, reply, ask, stream, acheive, unachieve, standby, ready, next, rest, discard, advertise, subscribe, monitor, register, unregister, forward, broadcast, pipe, break, transport-address, broker, recruit, recommend coined performatives ( Come to think of it, isn't this a nice set of verbs to name our methods? ). FIPA further refined these and acheived standardization among agent systems (I'll need to look up their spec again).
Just to digress a bit, Dirk Riehle author of JValue, classified methods into several types. These were the following: query ( get, boolean, comparison and conversion), mutation (set, command, initialization, finalization, configuration and constructor) and helper (factory, assertion, logging). I find these classifications interesting, in fact I should keep them in mind when I create new methods, perhaps they'll improve the classes I build.
In summary, its likely that you don't really need a large set of verbs to build complex systems. REST says you only need 4, I think it depends on the domain, however I do agree it shouldn't be many. In fact, the less verbs, the easier it is to reuse, and ultimately better interoperability.
This leaves me with the belief that SOAP and WSDL don't help in acheiving interoperability. An open ended definition of verbs just adds unnecessary complexity.
For posterity sake, I'm posting below a classification of verbs from the defunct www.endeavors.org open source project:
HTTP Methods: (RFC 2616)
- OPTIONS - (9.2) Let the client determine the communication requirements of the server without initiating a retrieval.
- GET - (9.3) Retrieve whatever data that is identified by a request.
- HEAD - (9.4) Return GET information without the message body.
- POST - (9.5) Perform an action on the server that may create a resource using the Request-URI.
- PUT - (9.6) Create a resource at the Request
- DELETE - (9.7) Delete the resource identified by the Request-URI
- TRACE - (9.8) Invoke an application-layer acknowledgement.
- CONNECT - (9.9) Reserved method for tunnel requests to a proxy.
WebDAV Methods:(RFC 2518)
- PROPFIND - (8.1) Retrieve the properties associated with a resource.
- PROPPATCH - (8.2) Process an instructions to set or remove a property.
- MKCOL - (8.3) Create a new collection.
- COPY - (8.8) Create a duplicate of a resource.
- MOVE - (8.9) Move a resource to the specified location.
- LOCK - (8.10) Lock access to a resource.
- UNLOCK - (8.11) Remove a lock from a resource.
Notification:
- NOTIFY - Send an event to a specific destination.
- PUBLISH - Broadcast an event to a particular channel that matches some filtering criteria.
- SUBSCRIBE - Listen to a particular channel defined by some filtering criteria.
- FILTER - Apply a filter to an event or event collection and return only the relevant notifications.
- SEARCH - Invoke a server-side query.
Presence:
- LOGON, LOGOFF - Asserting & retracting presence information.
Coordination:
- CREATE, SETUP - Setup and create the server-side environment to support a long-duration electronic service.
- RUN, INVOKE - Intiate a server-side service.
- HISTORY - Retrive the change, log, or transaction history of a resource or service.
- COMPLETE - Notify a resource that a remote service has completed with results.
- TERMINATE - Cancel a remote service.
Commerce & Costing:
- ESTIMATE - Request a cost estimate from a server for invoking a service.
- EXAMINE - Examine the ongoing cost factors/bill-to-date of a running service.
Services, Leasing, & Transactions:
- REGISTER/UNREGISTER - Announce the availability of a service.
- COMMIT - Confirm and initiate a set of changes or service invocation.
- ROLLBACK - Reset resource or service values to a previous point in their history.
- PROXY, BROKER - Intermediate a resource or service with some cost factors.

