Monday, January 21, 2008

Namespace-Time: Why REST and SOAP Composition Models are so Different

There's a mini-controversy going on over the importance of hyperlinks, and whether they're only usable by humans. Jonathan Marsh seems to think that hyperlinks are less useful for machine-to-machine interaction. The REST viewpoint seems to be that services without hyperlinks "dead-end" the Web, hence the absence of solid support for links in SOAP is a further argument against its usefulness.

I have (as usual) a different viewpoint on this altogether. I think SOAP and REST are duals. They both model the Universe of Discourse, but in different ways. With apologies to Einstein, I think the universe being modelled exists in a Namespace-Time continuum. REST lies on the Namespace axis where hyperlinks play (URIs form a namespace). SOAP lies on the Time axis, which is not surprising considering its verb-orientation. That also explains why there is much more emphasis on process orchestration in the SOAP/WS-* world ("Do this, then do that" is time-sequenced). Even within the SOAP/WS-* world, while services are verb-oriented, metadata on services is noun-oriented. No wonder many recent registries for SOAP-based services are based on RESTful APIs (WSO2 Registry and Mule Galaxy).

It would be silly to disparage REST for being silent on "process", just as it would be silly to accuse SOAP of "dead-ending" services from a namespace perspective.

REST resources are composable in Namespace (to form content). SOAP services are composable in Time (to form process). Decide how you want to model your Universe, then take your pick.

4 comments:

I'd just say it's a reflection of the age old "Data vs. Behaviour" battle over how information systems should be decomposed. They are very different cultures and mindsets.

Data-driven systems were in vogue through the 90's, until scalability, manageability, and reliability of "one big RDBMS" became untenable. So we split it up. But, data identifiers don't go away. Integrity and references don't go away. They just decay into poor quality.

Behavior-driven systems (OO domain models or business processes) have had a resurgence in interest, but tend towards brittle interoperability as governance boundaries are crossed, since the behavioral semantics are very hard to match. They also don't lend themselves well to reuse unless they are a) side-effect free functions, or b) very data-oriented.

Good points. Clearly, the hypermedia approach (REST) has proven its viability and usefulness. Have we exhausted the solution space, though? I keep thinking this is a problem with potentially multiple solutions but we've only explored one.

We certainly haven't exhausted the solution space. Having said this, new design mindsets, whether procedural, message-passing, relational, tuple-space, functional, OO, or hypermedia, do take a _long_ time to explore fully.

OO took 20+ years to catch on.

RDBMS took 18+ years to catch on (from Codd's paper in 1970 to market acceptance in 1988).

Tuple-spaces have been around for over 20+ years and still haven't quite caught on.

Hypermedia took around 25+ years to catch on, and it's taken another 10+ years to figure out that it's applicable as a general systems architecture.

No doubt we have more places to explore, but there's still a lot that can be found in this "new" area. ;-)

"To Analyse, Understand and Explain"

This site presents the technology-related opinions (wise or otherwise) of Ganesh Prasad - software architect, Java devotee and Open Source aficionado. (For my views on other topics, see this blog instead.)Disclaimer: Though I bear the name of the Hindu god of wisdom, Lord Ganesh, such cosmic wisdom is not always guaranteed to be transmitted through my writings. Reader beware!