rest compared mark baker, idokorro mobile inc.. rest compared will compare with other distributed...

22
REST Compared Mark Baker, Idokorro Mobile Inc.

Upload: xiomara-hodgkinson

Post on 28-Mar-2015

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

REST Compared

Mark Baker, Idokorro Mobile Inc.

Page 2: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

REST Compared

Will compare with other “Distributed Object”-like architectural styles i.e. “chuck messages at things with

behaviour, state, identity”

OO RPC (e.g. CORBA, DCOM, RMI)

Internet Email

Tuple Spaces

Page 3: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

REST Compared

Comparison criteria Object identification

Qualities of identification system Binding style

Given an identifier, the point at which an agent knows the interface

Application state engine How an application makes progress

Focus on “uniform interface” “The central feature that distinguishes the REST

architectural style from other network based styles is its emphasis on a uniform interface between components” – Roy Fielding, in his dissertation

Page 4: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Object Identification; OO-RPC

In practice, uses OIDs/UUIDs

Identifier only means something within context of system

Page 5: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Object Identification; Internet Email

Email addresses for mailboxes In practice, recognizable in all contexts

RFC 822 Message-Ids for messagese.g. <[email protected]>

Page 6: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Object Identification; Tuple Spaces

Typically uses local identifiers scoped to some host/port

Tuples are not identified

Page 7: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Object Identification; REST

URI Scheme as key innovation Provides hook for late binding Makes explicit what is implicit with other identifiers

“U” for Uniform/Universal Enables other systems to be engulfed

ftp host/path -> ftp://host/path [email protected] -> mailto:[email protected] “Principle of Independent Invention”

Resources and Representations identified by URI

Page 8: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Binding Style;OO RPC

To service offered by object;Early (aka static) binding I.e. Identifier is insufficient information for

use

To “management” interface;Late (aka dynamic) bindinge.g. IUnknown/IDispatch, CORBA::Object

Page 9: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Binding Style;Email

Late binding for mailboxesVia SMTP DATA methodSee an email address, invoke DATA

Page 10: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Binding Style;Tuple Spaces

Late bindingSee a Space, invoke in/rd/out,

read/write/take, etc..

Page 11: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Binding Style;REST

Late bindingSee a URI, invoke GET/PUT/POST/etc..

Page 12: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

App State Engine;OO RPC

Invoke methods Invoice.getSupplier()Sometimes get back an OID

Sometimes mobile code (load(“foo”)).execute()

Page 13: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

App State Engine;Email

Partly hypermedia “Reply to” a hypermedia action

Mostly ad-hoc

Page 14: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

App State Engine;Tuple Space

Blackboard styleTemplate matching on read()

Optional async notification of matches

Tuples don’t identify spaces

Page 15: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

App State Engine;REST

HypermediaWalk a typed graph

e.g. <a rel=“supplier” href=“http://example.org/supplier”>Supplier</a>

Each step declares possible state changes as hypermedia links

Page 16: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs with OO RPC

Interface Lightbulb

{

void turnOn();

void turnOff()

boolean isOn();

}

Many interfaces possible

Page 17: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs with Email

[email protected]

No reliable view of state of bulb; Inherent restriction with single, non-

idempotent mutator like SMTP DATASimilar issue with Tuple Spaces …

Page 18: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs withTuple Spaces

Interface Lightbulb

{

void write( Tuple );

Tuple read( Template );

Tuple take( Template );

Handle notify( Template );

}

Page 19: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs withTuple Spaces

Many Bulb-to-Space mappings; Bulb state = sum(tuples) mod 2 Bulb state = num(tuples) mod 2 Bulb state = last tuple

Choice determines many qualities of resulting system Can a client reliably determine the state? How easily can we recover from partial failure?

This issue is common to OO RPC and Email

Page 20: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs withREST

Interface Lightbulb

{

Representation GET();

void PUT( Representation );

void POST( Representation );

void DELETE();

}

Page 21: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

Lightbulbs withREST

GET() returns “on”, “off”PUT( “on” ) turns on, PUT( “off” ) turns offOnly one Bulb-to-Resource mappingPartial failure, view of system state more

manageable

Related bulbs, or other things, can be discovered as hyperlinks via GET

Page 22: REST Compared Mark Baker, Idokorro Mobile Inc.. REST Compared Will compare with other Distributed Object-like architectural styles i.e. chuck messages

PossibleDiscussion Points

What about a uniform interface makes it unsuitable for machine processing (as some have suggested)?What do we need to enable this?

Other Internet-scale architectural styles exist today, and will continue to do soWill Web Services be one?