How do distributed systems both cooperate and evolve?
That is a subtly different question than JJ asks:
when no human is in the loop, you need a shared understanding between the resource consumer and the resource (provider)The only viable choices JJ then describes (WSDL or WADL) do indeed provide a partial solution to coding shared understanding, but not evolution.
The short (flip?) answer to my leading question is to create a new media type that describes the semantics necessary for both consumers and providers to communicate.
In the case of exposing a Job Application Service as a RESTful provider that could mean the following:
- for a human provide an HTML response representation with forms for review, cancel, submit interview.
- for a machine provide an XML or RDF (or something) response representation.
- provide links/conformance to some shared schema type(s) (to share semantics)
- be extensible (in the "does not understand" sense)
- the shared schema can't pre-define URIs
- the shared schema can't pre-constrain all of the transition paths
The current conception of "shared understanding" is "shared interface". In the Job Application example that means the client service is encoded to expect after "Submit Review" that the service moved the job app to "reviewed". If the client service instead was coded to have a pair of (current job app data, desired state) when the service changed to a 2-stage review process the clients would likely continue to work:
- Client: Get job app 123
- Service: job app 123, submitted, "Submit Review", "Cancel"
- Client: "Submit Review" for job app 123
- Service: job app 123, review1, "Submit Review", "Cancel", "Reject"
- Client: "Submit Review" for job app 123
- Service: job app 123, reviewed, "Submit Interview", "Cancel", "Reject"
Just need to make sure of something about the Job Application Service example: is this service the provider or consumer of the lifecycle of a job app? It clearly has an internal state machine for job apps, but what other machine process does that get shared with?
[1] Some discussion (still searching for link...) hinted that WADL could be simply returned like an HTML Form, and not used to statically generate code. I think avoids the coupling of code-gen, but I'm not sure how it solves the problem of shared understanding either.
1 comment:
John:
thanks for the post, I think we are in complete agreement. Don't get me wrong I am not saying that WSDL or WADL are the best way to express this shared understanding. So I am not asking anybody to side behind WS-*. I'd love that we would all have the same way to express this shared understanding, because we'll be able to use ontologies of actions to create even a looser coupling. At least, understanding that the concept of a uniform interface is partially true is a big step forward.
The way you express available actions is a natural way of thinking for the REST camp, but IMHO, it forces you to always return (or GET later) the resource representation with the corresponding actions. Now what happens if it takes two days for the resource to change state based on your invocation?
RESTifarians are used to think "in-the-short", the "in-the-long" aspects of an application are the hardest to code. So far most people have "coded them in" deep inside the code.
IMHO, SOA is about managing these "in-the-long" aspects (of course the first step to manage them, is to make them explicit). I think that "in-the-short" REST is a perfectly viable way of thinking.
Thanks,
JJ-
Post a Comment