Linking Data & Actions      On the web      On the web   RESTfest 2012
Introduction• Stuart Charlton (@svrc)• Independent Consultant on cloud, REST,  agile delivery, and IT strategy• Weblog: St...
DisclaimerS•   This is a sequel (of sorts) to my 2011 WS-REST Keynote•   Mostly this is my naïve and incomplete thinking o...
Background• The Web Architecture has been an immense success...    • ... and yet, we can do better.• There’s a need to des...
My Claims• The Web architecture’s core strength is in encouraging small  pieces of independent agreement to be linked toge...
Why?
Why?• Troublesome Growth in Centralized Services    • e.g. Facebook, Twitter, Google+•   Centralization occurs in part bec...
Why?• REST APIs and Integration • Custom media types are the current approach... • ... but this generally is a transitory ...
Why?• Interoperable Domain Application Protocols•   RESTbucks vs RESTual Roasters: “All I wanted was a coffee - but I had ...
Why?• Programming models matter • In particular, the client’s model of how it interacts   with the server • We’re still of...
ProgrammingOr Scripts vs. Agents
Client/Server Programming
REST Raises the Level of Abstraction• The message vs. the resource/representation• Traditional Client/Server:  Client is a...
Hypermedia Programming
Qualities of the Agent• Goal-Directed• Reactive• Hypermedia workspace  (affordances, cached representations)• Sensing can ...
TWO POPULAR Ways to         Program ON The Web•   Linked Data    aka. “CRUD”•   Scripting against a REST API    aka. “Dyna...
A Third Way?    Linked                                      REST     Data                                       APIsGreat ...
Requirements•   Need to be able to describe actions    •   An action is a desired side-effect ; not an HTTP method    •   ...
A Third Way                        LinkedLinked                                            REST                       Beha...
Behavior Tree•   A constrained hierarchical finite state machine (HFSM)•   Approach to programming Game Agent AI (Halo 2, ...
Behavior Trees On the Web•   Specifying dynamic behavior as a search problem•   A behavior tree is effectively a process f...
Agent Design
Agent Design1.     Start with your basic app     information in the blackboard     (personal info, credit card, etc.)2.   ...
A Behavior Tree            Goal: Buy a coffee & tell my friends     Find                                   Tell Friends   ...
A Behavior Tree•   Each node is a hyperlink (may be an #anchor within a doc)•   Leaves are tasks: the interface with the W...
Distributed & linked              foo.com     Goal      &                                                  bar.org    Tact...
Atomic Tasks    Link Relations      (for sensing)                                                                ScriptCon...
Composite Tasks                                                                Selector                                   ...
Selector vs. Sequence
Example                       Find & Buy a Coffee•   Tree provided by me to my agent•   Find and Buy are effectively link ...
Example                      Find & Buy a Coffee•   Tree provided someone else for generic    “find something in a documen...
Example                       Find & Buy a Coffee•   Bindings to the “buy” link relation•   Provided by their respective o...
Example                        Find & Buy a Coffee•   Putting it all together
Summary• The Web architecture encourages clients to be designed as  agents in a dynamic information space• There are pract...
Upcoming SlideShare
Loading in …5
×

Linking Data and Actions on the Web

1,225 views

Published on

Keynote at RESTfest 2012

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,225
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Linking Data and Actions on the Web

  1. 1. Linking Data & Actions On the web On the web RESTfest 2012
  2. 2. Introduction• Stuart Charlton (@svrc)• Independent Consultant on cloud, REST, agile delivery, and IT strategy• Weblog: Stu Says Stuff http://www.stucharlton.com/blog• Many thanks to commenters and twitterers on this topic
  3. 3. DisclaimerS• This is a sequel (of sorts) to my 2011 WS-REST Keynote• Mostly this is my naïve and incomplete thinking on how to progress the state of the art.• Heavily in debt to ideas from Miro Samek (Statecharts) & Alex Champandard (Game AI), and Jim Webber / Savas Parastadtitis / Ian Robinson (REST in Practice)• I haven’t shared code to back this stuff up so cannot be trusted to be correct or even sane ... but bear with me, I think it’s at least going to be entertaining.
  4. 4. Background• 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?• “There’s no write side of the web really.... ... no, in fact, it‘s all GETs”
  5. 5. My Claims• 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.
  6. 6. Why?
  7. 7. Why?• Troublesome Growth in Centralized Services • e.g. Facebook, Twitter, Google+• Centralization occurs in part because of a limitation of the current web architecture • This is why we have 4 or 5 incompatible “like” buttons everywhere
  8. 8. Why?• REST APIs and Integration • Custom media types are the current approach... • ... but this generally is a transitory solution • “RESTful” design thrashing due to lack of prescriptive guidance • Would be reduced with more generic media types (e.g. as with HTML, AtomPub)
  9. 9. Why?• Interoperable Domain Application Protocols• RESTbucks vs RESTual Roasters: “All I wanted was a coffee - but I had to rewrite my client!”
  10. 10. Why?• Programming models matter • In particular, the client’s model of how it interacts with the server • We’re still often stuck on client method = network method (dynamic RPC)
  11. 11. ProgrammingOr Scripts vs. Agents
  12. 12. Client/Server Programming
  13. 13. REST Raises the Level of Abstraction• The message vs. the resource/representation• Traditional Client/Server: Client is a script sending/receiving messages• REST: Client is an agent acting in an information space
  14. 14. Hypermedia Programming
  15. 15. Qualities of the Agent• Goal-Directed• Reactive• Hypermedia workspace (affordances, cached representations)• Sensing can be done to pick up on effects
  16. 16. TWO POPULAR Ways to Program ON The Web• Linked Data aka. “CRUD”• Scripting against a REST API aka. “Dynamic RPCs across a pile of Link Relations”
  17. 17. A Third Way? Linked REST Data APIsGreat for interoperable Everyone understands itanalysis Mostly works wellNot so great for doing things Not often interoperable across sites
  18. 18. Requirements• Need to be able to describe actions • An action is a desired side-effect ; not an HTTP method • Build higher level behaviors while maintaining uniformity of protocol• Preferably describe these serendipitously • Searchable, linkable, follow-your-nose• Preferably without tight coupling to HTTP methods • One server’s action may require a single POST, another’s may require PUT-POST-POST• Present and process data in a uniform way (ala. linked data) • Express requirements, assertions and conditions
  19. 19. A Third Way LinkedLinked REST Behavior Data APIs Trees Interoperable actions and dataAn alternative (not replacement) to custom media types
  20. 20. Behavior Tree• A constrained hierarchical finite state machine (HFSM)• Approach to programming Game Agent AI (Halo 2, 3, GTA)• Constrained, how? • Goal-oriented HFSM • Reusable sub-states to enable “programming by difference” • Patterns for common programming constructs
  21. 21. Behavior Trees On the Web• Specifying dynamic behavior as a search problem• A behavior tree is effectively a process flow that’s assembled by a crawler and executed by depth first search• More complexity, potentially evolvability & less programming
  22. 22. Agent Design
  23. 23. Agent Design1. Start with your basic app information in the blackboard (personal info, credit card, etc.)2. Crawl the behavior tree, starting with your goal tree 23. Execute the tree, picking actions, 1 scripts, doing data transforms4. Update the blackboard with sensed state (via GETs) 55. Agent handler is notified when 4 certain blackboard values change 3 (i.e. as goal is reached or exceptions happen)
  24. 24. A Behavior Tree Goal: Buy a coffee & tell my friends Find Tell Friends Buy Order PayAppropriate Like coffee? Tweet
  25. 25. A Behavior Tree• Each node is a hyperlink (may be an #anchor within a doc)• Leaves are tasks: the interface with the Web and/or your Agent
  26. 26. Distributed & linked foo.com Goal & bar.org Tactics Behavior buz.biz Action Binding• Different domains & origin servers can describe pieces of the tree• Goals lead to behaviors, which trickle down into concrete
  27. 27. Atomic Tasks Link Relations (for sensing) ScriptConditions Actions• Relation links are GETted where found to change application state Conditions sense your application state Actions update (POST, PUT, DELETE) resource state Scripts enable code on demand to change application/resource state opaquely
  28. 28. Composite Tasks Selector Sequence• Branches control complexity by enabling higher-level logic Examples: selectors, sequences, decorators, filters, parallel, etc.
  29. 29. Selector vs. Sequence
  30. 30. Example Find & Buy a Coffee• Tree provided by me to my agent• Find and Buy are effectively link relations that others can reference that they implement with their own trees
  31. 31. Example Find & Buy a Coffee• Tree provided someone else for generic “find something in a document by a criteria”
  32. 32. Example Find & Buy a Coffee• Bindings to the “buy” link relation• Provided by their respective origin servers (or some good samaritan)
  33. 33. Example Find & Buy a Coffee• Putting it all together
  34. 34. Summary• 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 (blackboard, search, crawler)• Linked behavior trees may be a general purpose media type for systems to manipulate state on the web, in lieu of more specific media types

×