0
Mike Amundsen    @mamund
“You cant cross the sea merely by standing and staring atthe water.”- Rabindranath Tagore
Mike Amundsen Presenter, Architect, Programmer Current focus: “Hypermedia” New book coming…   Designing Hypermedia API...
Goals Identify common Web implementation  patterns Encourage you to re-think your habits Challenge existing frameworks ...
Non-Goals Explain the HTTP Protocol Defend the REST Style Promote/Denigrate any     Platform/OS     Programming Langu...
My Hidden Agenda
When I get done,I hope there will be…
Less of this…
More of this…
“Vision without action is a daydream. Action without visionis a nightmare.”– Japanese Proverb
ROT
RepresentationalObjectTransfer
RepresentationalObjectTransfer
Object“In computer science, an object is anyentity that can be manipulated by thecommands of a programming language,such a...
Why is this bad?
It’s a Web “anti-pattern”
Wait, it’s a what?
Anti-pattern   “In software engineering, an anti-    pattern (or antipattern) is a pattern that    may be commonly used b...
Anti-pattern   “In software engineering, an anti-    pattern (or antipattern) is a pattern that    may be commonly used b...
On the Web, ROTis ineffectiveand/orcounterproductive Object Serialization Type Marshaling
Type Marshaling Problems   Updates on the server can break the    clients     Objects/Members added/changed/removed   M...
On the Web,ROT doesn’t scale
This is NOT an HTTP Problem
This is the nature ofdistributed networks
Some examples please….
Schema Publishing ROT
Type Hints in the Payload ROT
URI Construction ROT
Object-Based Media Types ROT
They all suffer fromthe same shortcoming
They try to solvethe wrong problem
"How can a serversuccessfully export its privateobjects in a way thatclients can see and usethem?"Not the correct question…
"How cana server and client share acommon understanding ofthe payloads passed betweenthem?"Much better question…
We need to Stop sharing private objects Look beyond local “types” as sharing units Make it work across:     Platforms ...
“Freedom lies in being bold.”- Robert Frost
REST
RepresentationalStateTransfer
RepresentationalStateTransfer
State“In computer science and automata theory,a state is a unique configuration ofinformation in a program or machine.”- W...
“State” is not an object.
The “Type-less” Web The Web has no local “types” The Web doesn’t need any. The Web has payloads     Message     Metad...
We share the “state” of an app,not the objects on the server.
Ok, how do we share “state”?
We pass messages…
That’s it?
Well…
Not just “any” messages…
We share “state” on the Webusing a “media type”
Media Types text/html, application/xml, application/json, etc Elements, attributes, properties, arrays, etc. Structured...
Actually, there is aspecial group of media typesthat are “best” for the Web…
Hyper-media Types.
Hypermedia Types Notjust “what” name, email, price, size, … Also“how” a, link, img, form, input, …
Hypermedia messagescontain H-Factors
H-Factors Servers include these to tell clients what  they can do next… Link Factors Control Factors
Link Factors   LE = Link Embedding     HTML.IMG   LO = Link Outbound     HTML.A   LT = Link Template     HTML.FORM[a...
Control Factors   CR = Control Reads     HTML.LINK[rel=“stylesheet”]   CU = Control Updates     HTML.FORM[enctype=“tex...
On the Web,we share understandingusing media-types.
What do we understand?
What do we understand?
What do we understand?
What do we understand?
So we must designthe messages we share…
Design and Share Messages Where is the data? Where are the links? How can I send queries? How can I modify data?
And we must document thedesign…
And create servers thatunderstand the media type…
And write clients thatunderstand the media type…
That’s how the Web is meantto be played!
“The important thing is not to stop questioning.”- Albert Einstein
Stop Marshaling Types
Start Using Hypermedia
Start Designing Messages
Give us Less ROT and More REST
Enjoy the Benefits of the Web!
Mike Amundsen    @mamund
More REST less ROT (2011-06)
More REST less ROT (2011-06)
More REST less ROT (2011-06)
More REST less ROT (2011-06)
Upcoming SlideShare
Loading in...5
×

More REST less ROT (2011-06)

458

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
458
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "More REST less ROT (2011-06)"

  1. 1. Mike Amundsen @mamund
  2. 2. “You cant cross the sea merely by standing and staring atthe water.”- Rabindranath Tagore
  3. 3. Mike Amundsen Presenter, Architect, Programmer Current focus: “Hypermedia” New book coming… Designing Hypermedia APIs w/ HTML5 and NodeJS – O’Reilly, late 2011
  4. 4. Goals Identify common Web implementation patterns Encourage you to re-think your habits Challenge existing frameworks & tooling Improve the quality of information on the Web
  5. 5. Non-Goals Explain the HTTP Protocol Defend the REST Style Promote/Denigrate any  Platform/OS  Programming Language  Web Library or Framework
  6. 6. My Hidden Agenda
  7. 7. When I get done,I hope there will be…
  8. 8. Less of this…
  9. 9. More of this…
  10. 10. “Vision without action is a daydream. Action without visionis a nightmare.”– Japanese Proverb
  11. 11. ROT
  12. 12. RepresentationalObjectTransfer
  13. 13. RepresentationalObjectTransfer
  14. 14. Object“In computer science, an object is anyentity that can be manipulated by thecommands of a programming language,such as a value, variable, function, or datastructure.”- Wikipedia
  15. 15. Why is this bad?
  16. 16. It’s a Web “anti-pattern”
  17. 17. Wait, it’s a what?
  18. 18. Anti-pattern “In software engineering, an anti- pattern (or antipattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.” - Wikipedia
  19. 19. Anti-pattern “In software engineering, an anti- pattern (or antipattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.” - Wikipedia
  20. 20. On the Web, ROTis ineffectiveand/orcounterproductive Object Serialization Type Marshaling
  21. 21. Type Marshaling Problems Updates on the server can break the clients  Objects/Members added/changed/removed Moving to a new server/domain can break the clients  Object IDs (URIs) added/change/removed Modifying the process flow can break the clients  Object processing added/changed/removed
  22. 22. On the Web,ROT doesn’t scale
  23. 23. This is NOT an HTTP Problem
  24. 24. This is the nature ofdistributed networks
  25. 25. Some examples please….
  26. 26. Schema Publishing ROT
  27. 27. Type Hints in the Payload ROT
  28. 28. URI Construction ROT
  29. 29. Object-Based Media Types ROT
  30. 30. They all suffer fromthe same shortcoming
  31. 31. They try to solvethe wrong problem
  32. 32. "How can a serversuccessfully export its privateobjects in a way thatclients can see and usethem?"Not the correct question…
  33. 33. "How cana server and client share acommon understanding ofthe payloads passed betweenthem?"Much better question…
  34. 34. We need to Stop sharing private objects Look beyond local “types” as sharing units Make it work across:  Platforms  Languages  FrameworksWe need acommon understanding
  35. 35. “Freedom lies in being bold.”- Robert Frost
  36. 36. REST
  37. 37. RepresentationalStateTransfer
  38. 38. RepresentationalStateTransfer
  39. 39. State“In computer science and automata theory,a state is a unique configuration ofinformation in a program or machine.”- Wikipedia
  40. 40. “State” is not an object.
  41. 41. The “Type-less” Web The Web has no local “types” The Web doesn’t need any. The Web has payloads  Message  Metadata
  42. 42. We share the “state” of an app,not the objects on the server.
  43. 43. Ok, how do we share “state”?
  44. 44. We pass messages…
  45. 45. That’s it?
  46. 46. Well…
  47. 47. Not just “any” messages…
  48. 48. We share “state” on the Webusing a “media type”
  49. 49. Media Types text/html, application/xml, application/json, etc Elements, attributes, properties, arrays, etc. Structured, well-formed, valid, etc. Independent of  Platform  Language  Framework
  50. 50. Actually, there is aspecial group of media typesthat are “best” for the Web…
  51. 51. Hyper-media Types.
  52. 52. Hypermedia Types Notjust “what” name, email, price, size, … Also“how” a, link, img, form, input, …
  53. 53. Hypermedia messagescontain H-Factors
  54. 54. H-Factors Servers include these to tell clients what they can do next… Link Factors Control Factors
  55. 55. Link Factors LE = Link Embedding  HTML.IMG LO = Link Outbound  HTML.A LT = Link Template  HTML.FORM[action=“get”] LN = Link Non-Idempotent  HTML.FORM[action=“post”] LI = Link Idempotent  HTML.FORM[action=“put”]
  56. 56. Control Factors CR = Control Reads  HTML.LINK[rel=“stylesheet”] CU = Control Updates  HTML.FORM[enctype=“text/plain”] CM = Control Methods  HTML.FORM[method=“post”] CL = Control Links  A[rel=“payment”]
  57. 57. On the Web,we share understandingusing media-types.
  58. 58. What do we understand?
  59. 59. What do we understand?
  60. 60. What do we understand?
  61. 61. What do we understand?
  62. 62. So we must designthe messages we share…
  63. 63. Design and Share Messages Where is the data? Where are the links? How can I send queries? How can I modify data?
  64. 64. And we must document thedesign…
  65. 65. And create servers thatunderstand the media type…
  66. 66. And write clients thatunderstand the media type…
  67. 67. That’s how the Web is meantto be played!
  68. 68. “The important thing is not to stop questioning.”- Albert Einstein
  69. 69. Stop Marshaling Types
  70. 70. Start Using Hypermedia
  71. 71. Start Designing Messages
  72. 72. Give us Less ROT and More REST
  73. 73. Enjoy the Benefits of the Web!
  74. 74. Mike Amundsen @mamund
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×