I'll See You on the Write Side of the Web
-
Upload
ruyalarcon -
Category
Technology
-
view
948 -
download
1
description
Transcript of I'll See You on the Write Side of the Web
![Page 1: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/1.jpg)
the Write Side of the WebWS-REST 2011
I'll See You on
1
![Page 2: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/2.jpg)
Introduction• Stuart Charlton (@svrc)
• Director at Canadian Pacific Railway
• Formerly CTO of Elastra, a cloud computing product based on semantic web technology
• Weblog: Stu Says Stuffhttp://www.stucharlton.com/blog
• Many thanks to commenters and twitterers on this topic
2
![Page 3: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/3.jpg)
Theme• The Web Architecture has been an immense
success...
• ... and yet, we can do better.
• There’s a need to design the software for the write side of the web to scale and become nearly as serendipitous as the read side
• Is this even possible? Let’s find out.
3
![Page 4: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/4.jpg)
The Read Side
• GET
• RDFa/Microformats
• Browsing
• Atom & RSS feeds
• Search
• Semantic Web
4
![Page 5: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/5.jpg)
The Write Side
• POST
• AtomPub
• Integration
• Facebook Status
• Media Sharing
• e-Commerce
5
![Page 6: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/6.jpg)
Why?
6
![Page 7: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/7.jpg)
Why?
• Growth in Centralized Services
• e.g. Facebook
7
![Page 8: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/8.jpg)
Why?• Systems Integration
• Custom media types are the current approach...
• ... but that can only be a transitory solution
• Many “RESTful” design thrashing due to lack of prescriptive guidance
• Would be reduced with more generic media types (e.g. as with HTML, AtomPub)
8
![Page 9: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/9.jpg)
Why?
• REST is not CRUD (create, read, update, delete)
• Neither is HTTP
• POST does not map directly to ‘create’
• CRUD leads to complexity at scale
9
![Page 10: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/10.jpg)
Why?
• Programming models matter
• In particular, the clientʼs model of how it interacts with the server
• Process-driven? Or something else?
• Lots of innovation in this space...
10
![Page 11: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/11.jpg)
Theses
• The Web architecture’s core strength is in encouraging small pieces of independent agreement to be linked together and shared; we’re missing some agreements for writes
• The Web architecture encourages clients to be designed as agents in a dynamic information space
• There are practical approaches to programming agents in a dynamic environment
• It should be possible to create a general purpose media type for systems to manipulate state on the web, in lieu of more specific media types.
11
![Page 12: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/12.jpg)
Agreement
12
![Page 13: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/13.jpg)
Collaborative Systems Architecture
• “The greatest leverage in system architecting is at the interfaces. The greatest dangers are also at the interfaces.”
• “When the components of a system are highly independent, operationally and managerially, the architecture of the system is the interfaces.”(Maier & Rechtin, The Art of Systems Architecting)
• In Roy Speak....
• “[REST’s goals are] achieved by placing constraints on connector semantics where other styles have focused on components semantics.”
13
![Page 14: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/14.jpg)
Design for Serendipity
• “Chance encounters”
• Media types, link relations, RDFa/microformats, URI templates, well-known URIs, host meta, etc.
14
![Page 15: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/15.jpg)
What agreements could be helpful?
• Link relations for POST resources
• The effects of a POST
• cache invalidation
• pre/post conditions
• The contents of a POST
• e.g. RDF Forms
15
![Page 16: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/16.jpg)
Programming
16
![Page 17: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/17.jpg)
Client/Server Programming
Client Server
RemoteProcedure
HandlerNew Message
(optional)New Message
RequestMessageFormat
HandlerResponseMessageFormat
Create
ApplicationLogic &
ExceptionHandling
Invoke
17
![Page 18: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/18.jpg)
REST Raises the Level of Abstraction
• The message vs. the resource/representation
• Traditional Client/Server:Client is a program sending/receiving messages
• REST:Client is an agent acting in an information space
18
![Page 19: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/19.jpg)
Hypermedia Programming
Hypermedia AgentEnvironment
(The Web)
State of the application now
Transfer Desired State
Resource
Resource
CachedRepresentations Sensors
HTTP GET
Effectors Resource
Representation Logic
e.g. Link relations,Media type
specifications, pre/post conditions
Choose Desired State
Resource
Resource
Goals & Preferences
Exception Handlers
ModifyGoals
Runtime Events
HTTP POST
19
![Page 20: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/20.jpg)
Qualities of the Client
• Goal-Directed
• Reactive
• Hypermedia workspace(cached representations)
• Sensing can be done to pick up on effects
20
![Page 21: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/21.jpg)
Agents
21
![Page 22: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/22.jpg)
Agent
• Traditional agents are distinguished from mere programs via...
• The existence of an environment it needs to react to
• The autonomy for the agent to make detailed decisions for the user so long as it is seeking to achieve a goal
22
![Page 23: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/23.jpg)
The AI approach to Agents
• Automated Planning
• A process to determine an order of actions to be taken in pursuit of a goal
Current state of the world Description of actions Goals and constraints
Planner Required actions (plan)
23
![Page 24: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/24.jpg)
Example of Planning
Download X
Install X
Download package list
Install X Download Y
Install Y
Upgrade X
Upgrade Y
Download Z
Install Z
Upgrade Z
Download package list
Download X Download Y
Install Y
Install X
Set of all available actions Plan
(selected and ordered actions)
24
![Page 25: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/25.jpg)
An Alternative Approach
• Subsumption Architecture;aka. Hierarchical State Machines
15
STAGE n
STAGE 2
Development by subsumption
SYSTEM
time
Situation 1
Situation 2
Situation n
STAGE 1 STAGE 1
STAGE 2
!" !"
!" !"
!"
!"
0 Step 1 Step 2 Step n
……
…
Result…
STAGE 1
…
/32
15
STAGE n
STAGE 2
Development by subsumption
SYSTEM
time
Situation 1
Situation 2
Situation n
STAGE 1 STAGE 1
STAGE 2
!" !"
!" !"
!"
!"
0 Step 1 Step 2 Step n
……
…
Result…
STAGE 1
…/32
25
![Page 26: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/26.jpg)
Programming by Difference
• Coined by Miro Samek
• State nesting lets you define a new state rapidly in terms of an old one, by reusing semantics from the parent
• Reuse what is common, override what is not
26
![Page 27: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/27.jpg)
States in the Halo 2 Game Engine
27
![Page 28: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/28.jpg)
Agreements as a State Sandwich
Application State Machine!
Hypermedia Application State Machine!
HTTP State Machine!
Media State Machine!
...!
28
![Page 29: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/29.jpg)
Media Type
29
![Page 30: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/30.jpg)
Mapping Nested State Transitions to Restbucks
30
![Page 31: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/31.jpg)
State Chart XML• Promising W3C Draft; Hierarchical FSMs; JavaScript Code-on-Demand,
Expressions (Pre/Post Conditions), Event Model
• Weaknesses: Lacks Hyperlinks, Mandates Heavyweight Message Format
<state id="S" initial="s1"> <state id="s1" initial="s11"> <onexit> <log expr="'leaving s1'"/> </onexit> <state id="s11"> <onexit> <log expr="'leaving s11'"/> </onexit> </state> <transition event="e" target="s21"> <log expr="'executing transition'"/> </transition> </state> </state>
31
![Page 32: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/32.jpg)
Possible Characteristics
• JSON-based (and/or JS code on demand)
• Link relations for states, events, and transitions
• Events become identifiable elements of some representations
32
![Page 33: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/33.jpg)
Behave: A JavaScript State-Aware User Agent
• Implemented in node.js
• JSON-based linked state machines
• First release in May 2011
33
![Page 34: I'll See You on the Write Side of the Web](https://reader033.fdocuments.us/reader033/viewer/2022042715/55979d1f1a28abd8488b460b/html5/thumbnails/34.jpg)
Revisiting the Theses
• Agreements: The effects of a POST in context to other representations
• Programming: Instead of a RESTful client library, aim for an agent runtime
• Agents: Hierarchical state machines are promising today; hierarchical planning with sensing is a promising thread for research
• Media Type: Link relations for states and their transitions; the ability to nest states & transitions via hyperlinks
34