0
REST                     in (a mobile) peace                               May, 21st 2011Alessandro Nadalin
AgendaRest in a nutshellREST antipatternREST for the mobile world   How       HTTP cache        fault-tolerance, downtime-...
Sorry for the ugly slide. There will be others.    Really sorry.
A nutshellin (a mobile) peace
Lets go back!
2000Fieldings dissertation:REpresentationalStateTransferhttp://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style...
REST in a nutshell:
REST in a nutshell:1. Client <> Server
REST in a nutshell:           2. Stateless
easy to scale
Recover and  failover paradise
What about the user session?
Must die
REST in a nutshell:   3. Cacheable
REST in a nutshell:        When dealing with safe methods,  the response should be able to tell the client,     or whateve...
REST in a nutshell:4. Layered system
REST in a nutshell:           5. Uniform           interface
Uniform interface    hierarchic resource identification       Verbs to perform operations   manipulation through represent...
Richardson maturity model     hierarchic resource identification         Verbs to perform operations    manipulation throu...
Richardson maturity model                  mess     hierarchic resource identification       Verbs to perform operations  ...
Richardson maturity model           0.     mess     hierarchic resource identification       Verbs to perform operations  ...
0Using HTTP
Withoutgiving a f***
Richardson maturity model  1.         0.     mess       hierarchic resource identification         Verbs to perform operat...
1       mytastyproduct.com/usersmytastyproduct.com/users/1/licenses/4
Richardson maturity model  1.         0.     mess       hierarchic resource identification  2.     Verbs to perform operat...
2
Richardson maturity model  1.         0.     mess       hierarchic resource identification  2.     Verbs to perform operat...
3.    GODhttp://www.slideshare.net/trilancer/why-hateoas-1547275
Hyperlinks
Hypermedia formats http://amundsen.com/hypermedia/
Single entry point
Uniform interface is interesting.Everyone seem to have its own RESTful "service".But no one seem to entirely implement a u...
Uniform interface is interesting.Everyone seem to have its own RESTful "service".But no one seem to entirely implement a u...
NoRESTful stuff
But dont be too religious.REST gets raped everyday,get over it.
( a few ) ANTIPATTERNS    in (a mobile) peace
1URIs
"REST is about       cool URI design"http://apple.com/users/1/licenses/4.json
"REST is about       cool URI design"http://apple.com/users/1/licenses/4.json
http://apple.com/site/en_US/showUsers.jsp?uid=1&license=4              is OK too
but
"cool URIs help youthink in term of resources"                 - David Zuelke
and, by the way
a URI should neverlocate different resources
a URI should neverlocate different resourceswhile a resource could belocated by different URIs
2URIs (bis)
REST follows a URI schema
REST follows a URI schema       GET /users       POST /users       PUT /users/{id}       DELETE /users/{id}       ...
REST follows a URI schema       GET /users       POST /users       PUT /users/{id}       DELETE /users/{id}       ...
URI templates suck, some say
what if you change your         URL?
Yeah,client isbroken
RESTful clients should      be driven by services      hypermedia controlsRoy Fielding : http://roy.gbiv.com/untangled/200...
3Formats
REST =XML
REST =XML
a representation varies  based on the format
Can be:application/xmlapplication/jsonaudio/mp4image/png
Can be:   application/xml   application/json   audio/mp4   image/pngbut also:text/dnsvideo/vnd.motorola.videotext/uri-list
dear JSON, by the way
JSON is evil
{    "date": "2011-01-01",    "stock": "100",    "price": "12"}
The business evolves
{    "date": "2011-01-01",    "stock": "100",    "price": [      {"currency": "EUR", "amount": "12"},      {"currency": "U...
Yeah,client isbroken
Everything is a tradeoff
4POST is cool
said SOAP 1.1
said SOAP 1.1
loosing meaningful verbs at the protocol level
loosing meaningful verbs at the protocol level        nothing cacheable by default
loosing meaningful verbs at the protocol level        nothing cacheable by default         what about bookmarking?
5500 is your friend
said SOAP   ( again )
GET /users/300Host: www.example.com
GET /users/300        Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record ...
GET /users/300        Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record ...
The HTTP protocol is awesome,and lets you return meaningful anduniversally-understood status codes
404 Not Found
404 Not FoundOMG Link is broken?
202 Accepted
202 AcceptedYou get an immediate OK, and the operation will hopefully complete
412 Precondition Failed
412 Precondition Failed   Want money?.. Got money?
The serious s**t   in (a mobile) peace
How do Iimplement   thisgoodness?
1.caching & scalability
HTTPyour long-time friend
Types of cache        Local    Shared/proxy Shared/reverse proxy
Types of cache        Local    Shared/proxy Shared/reverse proxy
Types of cache        Local   Shared/proxy Shared/reverse proxy
Types of cache       Local    Shared/proxyShared/reverse proxy
on the server side
Proxy            Reverse proxy        http://www.codeproject.com/KB/aspnet/ExploringCaching.aspx
There is something cool aboutcaching softwares.
Free as free beer
...but the server should take advantage of them( the boring part were you need to write code )
and here are a few ways to do so,using
and here are a few ways to do so,using           expiration
and here are a few ways to do so,using           expiration           validation
and here are a few ways to do so,using           expiration           validation          invalidation
and here are a few ways to do so,using           expiration           validation                     we will se why       ...
Expiration
GET / HTTP/1.1Host: www.example.comExpires: 0
GET / HTTP/1.1Host: www.example.comExpires: 0
GET / HTTP/1.1Host: www.example.comExpires: Tue, 15 Nov 1994 01:00 GMT
GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public
GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public
GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public       Cacheable for 60 seconds
GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, publicCacheable by both local and shared caches
GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600
GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600                        fa...
GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600                    availa...
GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600                  availabl...
Validation
GET / HTTP/1.1Host: www.example.comEtag: 1234
GET / HTTP/1.1 Host: www.example.com Etag: 1234an identifier for your response
Conditional requests        GET / HTTP/1.1        Host: www.example.com        If-None-Match: 1234the browsers asks you if...
Relax
Calculating an Etag is cheaper than generating a full MVC response
HTTP/1.1 304 Not Modified
GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT
GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT          tell the client about the latest ...
Conditional requestsGET / HTTP/1.1Host: www.example.comIf-Modified-Since: Tue, 15 Jan 2011 12:00:00 GMT  the client asks y...
Relax
Calculating a date is cheaper than retrieving an entire object
HTTP/1.1 304 Not Modified
Invalidation
The web is not meant for invalidating data.Server should not be able to keep clients state, otherwise they                ...
but hey, you say
HTTPs cache fails when dealing with really dynamic pages,because consumers will always have to hit the origin server,altho...
Nope       Nope
ESI was built for that     http://www.w3.org/TR/esi-lang
Edge Side Includes   A de facto standard for bla bla bla...
Edge Side Includes         A de facto standard for bla bla bla... Server side includes ( not SSI! ) usually handled by the...
<esi:include src="http://whymca.org/talks/1" />
<esi:include src="http://whymca.org/talks/1" />
<esi:include src="http://whymca.org/talks/1" />
This is a response
15 seconds cache30 minutes cache
and hey, Varnish is a reverse proxy implementing what you               need of the ESI specification                    t...
So what does HTTP cache is meant to solve?
Less work
http://www.flickr.com/photos/snakphotography/5004775320/sizes/o/in/photostream/        because the hard work is delegated ...
evolve
because cache is abstracted from the application
loose coupling
because caching is bound to the protocol, HTTP, notto your implementation ( Sf, RoR, Django )
2.adaptability & durability
Hypermedia  another long-time friend
Linksoutrageously semplifying
<img src="..." /><a href="..." /><link rel="payment" ... />
<img src="..." /><a href="..." /><link rel="payment" ... />
<img src="..." /><a href="..." /><link rel="payment" ... />
Atomis your friendhttp://www.xml.com/lpt/a/1434
<link rel="payment" href="/checkout" type="text/html" ... />
<link rel="payment" href="/checkout" type="text/html" ... />
<link rel="payment" href="/checkout" type="text/html" ... />
<link rel="payment" href="/checkout" type="text/html" ... />
POST /usersHost: www.example.com
POST /users       Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /...
POST /users       Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /...
POST /usersHost: www.example.com
POST /users       Host: www.example.comHTTP/1.1 301 Moved permanentlyHost: www.example.comLocation: /users
POST /usersHost: www.example.com
POST /users       Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /...
POST /users       Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /...
POST /users          Host: www.example.com   Helps refactoring legacy stuff indeed :)HTTP/1.1 201 CreatedHost: www.example...
consumers of your API are able to follow      the changes of your design
Clients are too important       to breakem
and here comes a controversial part...
Like it or not,     XML is a friend of the   non BC-breaking evolutionhttp://www.slideshare.net/Wombert/xml-versus-the-new...
BTW<xml...> <product...>  <price>25</price> </product></xml>
BTW<xml...> <product...>  <price currency="EUR">25</price>  <price currency="USD">23</price> </product></xml>
As said, everything is a tradeoff
Choose the media type   for your needs
No need to be religious. Ever.
Why being in (a mobile) peace?
everything seems cool
everything seems cool        but why REST?
ProsPerformances
ProsScalability
http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website                 http://t...
Pros       Durability
"REST is software design on the scale of decades: every detail is intended to promote software longevity and independent e...
Put a bit of   RESTeverywhere
Rules of good   design
amazon.it
Alessandro Nadalin
Alessandro Nadalin         odino.org
Alessandro Nadalin         odino.org        @_odino_
Alessandro Nadalin         odino.org        @_odino_
ThanksAlessandro Nadalin         odino.org        @_odino_
Credits       http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/  http://www.flickr.com/photos/ashate...
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
Upcoming SlideShare
Loading in...5
×

REST in ( a mobile ) peace @ WHYMCA 05-21-2011

3,279

Published on

RESTful architectures and the advantage for HTTP consumers.

Focused on what matters to the mobile world: performances & scalability.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,279
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
35
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "REST in ( a mobile ) peace @ WHYMCA 05-21-2011"

  1. 1. REST in (a mobile) peace May, 21st 2011Alessandro Nadalin
  2. 2. AgendaRest in a nutshellREST antipatternREST for the mobile world How HTTP cache fault-tolerance, downtime-availability ESI Atom + Hypermedia controls Why performances evolution cost adaptability
  3. 3. Sorry for the ugly slide. There will be others. Really sorry.
  4. 4. A nutshellin (a mobile) peace
  5. 5. Lets go back!
  6. 6. 2000Fieldings dissertation:REpresentationalStateTransferhttp://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  7. 7. REST in a nutshell:
  8. 8. REST in a nutshell:1. Client <> Server
  9. 9. REST in a nutshell: 2. Stateless
  10. 10. easy to scale
  11. 11. Recover and failover paradise
  12. 12. What about the user session?
  13. 13. Must die
  14. 14. REST in a nutshell: 3. Cacheable
  15. 15. REST in a nutshell: When dealing with safe methods, the response should be able to tell the client, or whatever stands behind the request, how to cache it.
  16. 16. REST in a nutshell:4. Layered system
  17. 17. REST in a nutshell: 5. Uniform interface
  18. 18. Uniform interface hierarchic resource identification Verbs to perform operations manipulation through representation HATEOAS
  19. 19. Richardson maturity model hierarchic resource identification Verbs to perform operations manipulation through representation HATEOAS Really well explained by Fowler: http://martinfowler. com/articles/richardsonMaturityModel.html#level0
  20. 20. Richardson maturity model mess hierarchic resource identification Verbs to perform operations HATEOAS
  21. 21. Richardson maturity model 0. mess hierarchic resource identification Verbs to perform operations HATEOAS
  22. 22. 0Using HTTP
  23. 23. Withoutgiving a f***
  24. 24. Richardson maturity model 1. 0. mess hierarchic resource identification Verbs to perform operations HATEOAS
  25. 25. 1 mytastyproduct.com/usersmytastyproduct.com/users/1/licenses/4
  26. 26. Richardson maturity model 1. 0. mess hierarchic resource identification 2. Verbs to perform operations HATEOAS
  27. 27. 2
  28. 28. Richardson maturity model 1. 0. mess hierarchic resource identification 2. Verbs to perform operations 3. HATEOAS
  29. 29. 3. GODhttp://www.slideshare.net/trilancer/why-hateoas-1547275
  30. 30. Hyperlinks
  31. 31. Hypermedia formats http://amundsen.com/hypermedia/
  32. 32. Single entry point
  33. 33. Uniform interface is interesting.Everyone seem to have its own RESTful "service".But no one seem to entirely implement a uniform interface.
  34. 34. Uniform interface is interesting.Everyone seem to have its own RESTful "service".But no one seem to entirely implement a uniform interface. That means... ...?
  35. 35. NoRESTful stuff
  36. 36. But dont be too religious.REST gets raped everyday,get over it.
  37. 37. ( a few ) ANTIPATTERNS in (a mobile) peace
  38. 38. 1URIs
  39. 39. "REST is about cool URI design"http://apple.com/users/1/licenses/4.json
  40. 40. "REST is about cool URI design"http://apple.com/users/1/licenses/4.json
  41. 41. http://apple.com/site/en_US/showUsers.jsp?uid=1&license=4 is OK too
  42. 42. but
  43. 43. "cool URIs help youthink in term of resources" - David Zuelke
  44. 44. and, by the way
  45. 45. a URI should neverlocate different resources
  46. 46. a URI should neverlocate different resourceswhile a resource could belocated by different URIs
  47. 47. 2URIs (bis)
  48. 48. REST follows a URI schema
  49. 49. REST follows a URI schema GET /users POST /users PUT /users/{id} DELETE /users/{id} ...
  50. 50. REST follows a URI schema GET /users POST /users PUT /users/{id} DELETE /users/{id} ...
  51. 51. URI templates suck, some say
  52. 52. what if you change your URL?
  53. 53. Yeah,client isbroken
  54. 54. RESTful clients should be driven by services hypermedia controlsRoy Fielding : http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
  55. 55. 3Formats
  56. 56. REST =XML
  57. 57. REST =XML
  58. 58. a representation varies based on the format
  59. 59. Can be:application/xmlapplication/jsonaudio/mp4image/png
  60. 60. Can be: application/xml application/json audio/mp4 image/pngbut also:text/dnsvideo/vnd.motorola.videotext/uri-list
  61. 61. dear JSON, by the way
  62. 62. JSON is evil
  63. 63. { "date": "2011-01-01", "stock": "100", "price": "12"}
  64. 64. The business evolves
  65. 65. { "date": "2011-01-01", "stock": "100", "price": [ {"currency": "EUR", "amount": "12"}, {"currency": "USD", "amount": "10"} ]} Credits: http://twitter.com/#!/odracci
  66. 66. Yeah,client isbroken
  67. 67. Everything is a tradeoff
  68. 68. 4POST is cool
  69. 69. said SOAP 1.1
  70. 70. said SOAP 1.1
  71. 71. loosing meaningful verbs at the protocol level
  72. 72. loosing meaningful verbs at the protocol level nothing cacheable by default
  73. 73. loosing meaningful verbs at the protocol level nothing cacheable by default what about bookmarking?
  74. 74. 5500 is your friend
  75. 75. said SOAP ( again )
  76. 76. GET /users/300Host: www.example.com
  77. 77. GET /users/300 Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record cannot be found
  78. 78. GET /users/300 Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record cannot be found
  79. 79. The HTTP protocol is awesome,and lets you return meaningful anduniversally-understood status codes
  80. 80. 404 Not Found
  81. 81. 404 Not FoundOMG Link is broken?
  82. 82. 202 Accepted
  83. 83. 202 AcceptedYou get an immediate OK, and the operation will hopefully complete
  84. 84. 412 Precondition Failed
  85. 85. 412 Precondition Failed Want money?.. Got money?
  86. 86. The serious s**t in (a mobile) peace
  87. 87. How do Iimplement thisgoodness?
  88. 88. 1.caching & scalability
  89. 89. HTTPyour long-time friend
  90. 90. Types of cache Local Shared/proxy Shared/reverse proxy
  91. 91. Types of cache Local Shared/proxy Shared/reverse proxy
  92. 92. Types of cache Local Shared/proxy Shared/reverse proxy
  93. 93. Types of cache Local Shared/proxyShared/reverse proxy
  94. 94. on the server side
  95. 95. Proxy Reverse proxy http://www.codeproject.com/KB/aspnet/ExploringCaching.aspx
  96. 96. There is something cool aboutcaching softwares.
  97. 97. Free as free beer
  98. 98. ...but the server should take advantage of them( the boring part were you need to write code )
  99. 99. and here are a few ways to do so,using
  100. 100. and here are a few ways to do so,using expiration
  101. 101. and here are a few ways to do so,using expiration validation
  102. 102. and here are a few ways to do so,using expiration validation invalidation
  103. 103. and here are a few ways to do so,using expiration validation we will se why invalidation
  104. 104. Expiration
  105. 105. GET / HTTP/1.1Host: www.example.comExpires: 0
  106. 106. GET / HTTP/1.1Host: www.example.comExpires: 0
  107. 107. GET / HTTP/1.1Host: www.example.comExpires: Tue, 15 Nov 1994 01:00 GMT
  108. 108. GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public
  109. 109. GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public
  110. 110. GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public Cacheable for 60 seconds
  111. 111. GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, publicCacheable by both local and shared caches
  112. 112. GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600
  113. 113. GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600 fault-tolerant
  114. 114. GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600 available during downtime
  115. 115. GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600 available during revalidation
  116. 116. Validation
  117. 117. GET / HTTP/1.1Host: www.example.comEtag: 1234
  118. 118. GET / HTTP/1.1 Host: www.example.com Etag: 1234an identifier for your response
  119. 119. Conditional requests GET / HTTP/1.1 Host: www.example.com If-None-Match: 1234the browsers asks you if it has been modified
  120. 120. Relax
  121. 121. Calculating an Etag is cheaper than generating a full MVC response
  122. 122. HTTP/1.1 304 Not Modified
  123. 123. GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT
  124. 124. GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT tell the client about the latest change
  125. 125. Conditional requestsGET / HTTP/1.1Host: www.example.comIf-Modified-Since: Tue, 15 Jan 2011 12:00:00 GMT the client asks you if it has been modified since the last time
  126. 126. Relax
  127. 127. Calculating a date is cheaper than retrieving an entire object
  128. 128. HTTP/1.1 304 Not Modified
  129. 129. Invalidation
  130. 130. The web is not meant for invalidating data.Server should not be able to keep clients state, otherwise they wont scale well.Thats why long-polling and endless connections havent had big success dealing with caching.
  131. 131. but hey, you say
  132. 132. HTTPs cache fails when dealing with really dynamic pages,because consumers will always have to hit the origin server,although a part of the page would be cacheable ( header and footer, for example )
  133. 133. Nope Nope
  134. 134. ESI was built for that http://www.w3.org/TR/esi-lang
  135. 135. Edge Side Includes A de facto standard for bla bla bla...
  136. 136. Edge Side Includes A de facto standard for bla bla bla... Server side includes ( not SSI! ) usually handled by the architectures ESI processor. http://www.w3.org/TR/esi-lang http://www.w3.org/TR/edge-arch
  137. 137. <esi:include src="http://whymca.org/talks/1" />
  138. 138. <esi:include src="http://whymca.org/talks/1" />
  139. 139. <esi:include src="http://whymca.org/talks/1" />
  140. 140. This is a response
  141. 141. 15 seconds cache30 minutes cache
  142. 142. and hey, Varnish is a reverse proxy implementing what you need of the ESI specification take 2, pay for 1
  143. 143. So what does HTTP cache is meant to solve?
  144. 144. Less work
  145. 145. http://www.flickr.com/photos/snakphotography/5004775320/sizes/o/in/photostream/ because the hard work is delegated to the browser/proxy
  146. 146. evolve
  147. 147. because cache is abstracted from the application
  148. 148. loose coupling
  149. 149. because caching is bound to the protocol, HTTP, notto your implementation ( Sf, RoR, Django )
  150. 150. 2.adaptability & durability
  151. 151. Hypermedia another long-time friend
  152. 152. Linksoutrageously semplifying
  153. 153. <img src="..." /><a href="..." /><link rel="payment" ... />
  154. 154. <img src="..." /><a href="..." /><link rel="payment" ... />
  155. 155. <img src="..." /><a href="..." /><link rel="payment" ... />
  156. 156. Atomis your friendhttp://www.xml.com/lpt/a/1434
  157. 157. <link rel="payment" href="/checkout" type="text/html" ... />
  158. 158. <link rel="payment" href="/checkout" type="text/html" ... />
  159. 159. <link rel="payment" href="/checkout" type="text/html" ... />
  160. 160. <link rel="payment" href="/checkout" type="text/html" ... />
  161. 161. POST /usersHost: www.example.com
  162. 162. POST /users Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /users/1
  163. 163. POST /users Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /users/1
  164. 164. POST /usersHost: www.example.com
  165. 165. POST /users Host: www.example.comHTTP/1.1 301 Moved permanentlyHost: www.example.comLocation: /users
  166. 166. POST /usersHost: www.example.com
  167. 167. POST /users Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /newusersdatabase/1
  168. 168. POST /users Host: www.example.comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /newusersdatabase/1
  169. 169. POST /users Host: www.example.com Helps refactoring legacy stuff indeed :)HTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /newusersdatabase/1
  170. 170. consumers of your API are able to follow the changes of your design
  171. 171. Clients are too important to breakem
  172. 172. and here comes a controversial part...
  173. 173. Like it or not, XML is a friend of the non BC-breaking evolutionhttp://www.slideshare.net/Wombert/xml-versus-the-new-kids-on-the-block-phpbnl11-20110129 http://www.odino.org/320/long-live-xml-too-sorry-for-json-fanboyz
  174. 174. BTW<xml...> <product...> <price>25</price> </product></xml>
  175. 175. BTW<xml...> <product...> <price currency="EUR">25</price> <price currency="USD">23</price> </product></xml>
  176. 176. As said, everything is a tradeoff
  177. 177. Choose the media type for your needs
  178. 178. No need to be religious. Ever.
  179. 179. Why being in (a mobile) peace?
  180. 180. everything seems cool
  181. 181. everything seems cool but why REST?
  182. 182. ProsPerformances
  183. 183. ProsScalability
  184. 184. http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website http://tech.groups.yahoo.com/group/rest-discuss/message/17370 +2.500% traffic
  185. 185. Pros Durability
  186. 186. "REST is software design on the scale of decades: every detail is intended to promote software longevity and independent evolution. Many of the constraints are directlyopposed to short-term efficiency. Unfortunately, people are fairly good at short-term design, and usually awful at long-term design. " Roy Fielding
  187. 187. Put a bit of RESTeverywhere
  188. 188. Rules of good design
  189. 189. amazon.it
  190. 190. Alessandro Nadalin
  191. 191. Alessandro Nadalin odino.org
  192. 192. Alessandro Nadalin odino.org @_odino_
  193. 193. Alessandro Nadalin odino.org @_odino_
  194. 194. ThanksAlessandro Nadalin odino.org @_odino_
  195. 195. Credits http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/ http://www.flickr.com/photos/ashatenbroeke/4367373081/sizes/z/in/photostream/ http://www.flickr.com/photos/yourdon/3140270189/sizes/l/in/photostream/ http://www.flickr.com/photos/jox1989/4964706072/sizes/l/in/photostream/ http://www.flickr.com/photos/brainfg/168506259/sizes/o/in/photostream/ http://www.flickr.com/photos/norte_it/3897091546/sizes/o/in/photostream/ http://www.zdnet.com/blog/service-oriented/soap-versus-rest-a-matter-of-style/3568http://www.flickr.com/photos/turtlemom_nancy/2046347762/sizes/l/in/photostream/ http://www.flickr.com/photos/juanpg/3333385784/sizes/z/in/photostream/ http://www.flickr.com/photos/congvo/301678287/sizes/l/in/photostream/ http://www.flickr.com/photos/ihasb33r/2573196546/sizes/z/in/photostream/ http://www.flickr.com/photos/martin_heigan/4544138976/sizes/o/in/photostream/ http://www.flickr.com/photos/cknara/4195099999/sizes/o/in/photostream/ http://www.flickr.com/photos/1080p/3076529265/sizes/l/in/photostream/ http://www.flickr.com/photos/adamrice/280300202/sizes/l/in/photostream/ http://www.flickr.com/photos/tomer_a/541411897/sizes/o/in/photostream/ http://www.flickr.com/photos/subpra/4514008262/sizes/l/in/photostream/ http://www.flickr.com/photos/lippincott/2539720043/sizes/l/in/photostream/ http://www.flickr.com/photos/rawryder/5086090931/sizes/l/in/photostream/ http://www.flickr.com/photos/robboudon/5312731161/sizes/l/in/photostream/ http://www.flickr.com/photos/bc-burnslibrary/4158243488/sizes/o/in/photostream/http://www.flickr.com/photos/13606325@N08/2416993706/sizes/o/in/photostream/ http://www.flickr.com/photos/neothezion/5135841069/sizes/l/in/photostream/ http://www.flickr.com/photos/planetschwa/2494067809/ http://www.flickr.com/photos/thomasthomas/258931782/ http://www.flickr.com/photos/rustyboxcars/2629631562/sizes/l/in/photostream/ http://www.flickr.com/photos/ell-r-brown/4138727474/sizes/l/in/photostream/ http://www.flickr.com/photos/noah123/5082076630/sizes/z/in/photostream/ http://www.flickr.com/photos/jungle_boy/220181177/sizes/l/in/photostream/ http://www.flickr.com/photos/prettydaisies/872539081/sizes/l/in/photostream/ http://www.flickr.com/photos/kaptainkobold/76256150/sizes/o/in/photostream/ http://www.flickr.com/photos/uomoincravatta/1438372865/sizes/z/in/photostream/
  1. A particular slide catching your eye?

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

×