|
Just
returned from a trip and had to wade through a flood of messages sparked by my
lightbulb example.
Looks like Steve, Radovan and others have put
forward most of the relevant arguments.
[Mark Baker] Sure, but your service oriented approach also has to define
those
things *and* the operations. That's extra agreement that my solution doesn't require, because my solution reuses existing pervasively understood operations. I'd call that simpler. My
solution
- defines a Lightbulb service with the
operations 'TurnOn' (no parameters), 'TurnOff' (no parameters) and Dim
(with parameter 'luminosity')
-
uses WSDL to formally define the service contract (service interface messages
and associated data)
- doesn't need to know about PUT (may
not even use HTTP)
-
relies on asynchronous message exchanges and uses WS-Addressing to manage
them
Your
solution
-
defines a Lightbulb resource with state attributes 'state' (values 'on' and
'off') and 'luminosity' (with corresponding value)
-
has no formalized interface beyond GET, PUT, POST and DELETE, hence the use
of hard-coded names and values of state attributes and the risk of
inconsistency between client and server
-
has no standard provisions for asynchronous message exchange, hence relies on
clumsy workarounds for achieving something remotely similar
It
seems to me that your solution's apparent simplicity is just
that: apparent. The "uniform interface" is the tip of the iceberg, the
actual complexity is in handling the state representations -- some say "the
data", but is it reasonable to handle all data as state
representations?
Let
me extend the example a bit by making the lightbulb more intelligent, in such a
way that it can optimally adjust its luminosity (and maybe other
characteristics such as its color) according to the profile of
the person sitting at the desk that the bulb illuminates. (BTW, this is not an
academic example).
In
the service-oriented approach, one would extend the lightbulb interface
with a 'Personalize' operation to which a complex data type representing a
person profile would be associated. When receiving a 'Personalize' message,
the lightbulb would examine the profile, extract the relevant information and
set its luminosity accordingly.
How
would you handle this RESTfully? One could add a MIME type 'profile'
and send the lightbulb an HTTP/POST message containing something like
'personalize' together with the profile data. But that wouldn't seem
very RESTful since the profile represents a person, not a
lightbulb.
But
whatever your solution, with both approaches the actual complexity resides in
the processing of the profile. In comparison, whether you make the 'personalize'
operation explicit or put it inside the message in the form of a state
attribute seems a fairly minor aspect to me.
Harm. __._,_.___ YAHOO! GROUPS LINKS
|
Title: Message
- Re: [service-orientated-architecture] RESTful lightbulb Radovan Janecek
- Re: [service-orientated-architecture] RESTful lightbu... Stefan Tilkov
- Re: [service-orientated-architecture] RESTful lig... Radovan Janecek
- Re: [service-orientated-architecture] RESTful... Stefan Tilkov
- Re: [service-orientated-architecture] RES... Radovan Janecek
- Re: [service-orientated-architecture] RES... Steve Jones
- Re: [service-orientated-architecture] RESTful lightbulb Eric Newcomer
- RE: [service-orientated-architecture] RESTful lightbulb Harm Smit
