Restinpeaceosidays2011 111121093818-phpapp02
Upcoming SlideShare
Loading in...5
×
 

Restinpeaceosidays2011 111121093818-phpapp02

on

  • 920 views

 

Statistics

Views

Total Views
920
Slideshare-icon Views on SlideShare
642
Embed Views
278

Actions

Likes
0
Downloads
3
Comments
0

2 Embeds 278

http://2011.osidays.com 175
http://osidays2011.internal.osscube.com 103

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Restinpeaceosidays2011 111121093818-phpapp02 Restinpeaceosidays2011 111121093818-phpapp02 Presentation Transcript

    • RESTin peaceBengaluru, 20-22 November 2011
    • Sorry for the ugly slide. There will be others. Really sorry. Bengaluru, 20-22 November 2011
    • REST in a nutshell Bengaluru, 20-22 November 2011
    • 2000 Fieldings dissertation: REpresentational State Transferhttp://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Bengaluru, 20-22 November 2011
    • REST in a nutshell:1. Client <> Server Bengaluru, 20-22 November 2011
    • REST in a nutshell: 2. Stateless Bengaluru, 20-22 November 2011
    • Servers do not keep anyinformations the clients uses during different requests. Bengaluru, 20-22 November 2011
    • So the architecture scales well. Bengaluru, 20-22 November 2011
    • REST in a nutshell: 3. Cacheable Bengaluru, 20-22 November 2011
    • Client has access toresources stored between it and the origin server. Bengaluru, 20-22 November 2011
    • So communication is faster. Bengaluru, 20-22 November 2011
    • REST in a nutshell:4. Layered system Bengaluru, 20-22 November 2011
    • Intermediary nodes can beused along our architecture. Bengaluru, 20-22 November 2011
    • So you efficiently implement point 3. Bengaluru, 20-22 November 2011
    • REST in a nutshell: 5. Uniform interface Bengaluru, 20-22 November 2011
    • Communicate using well-known verbs and providing all the informations needed to consume a service. Bengaluru, 20-22 November 2011
    • So fallbacks are easy. Bengaluru, 20-22 November 2011
    • this was a bit difficult to understand so, obviously... Bengaluru, 20-22 November 2011
    • nobody had a clue Bengaluru, 20-22 November 2011
    • ANTIPATTERNS Bengaluru, 20-22 November 2011
    • 1 URIsBengaluru, 20-22 November 2011
    • "REST is about cool URI design"http://apple.com/users/1/licenses/4.json Bengaluru, 20-22 November 2011
    • "REST is about cool URI design"http://apple.com/users/1/licenses/4.json Bengaluru, 20-22 November 2011
    • http://apple.com/site/en_US/showUsers.jsp?uid=1&license=4 is OK too Bengaluru, 20-22 November 2011
    • but, enter simple rule of thumb Bengaluru, 20-22 November 2011
    • cool URIs help youthink in term of resources - David Zuelke Bengaluru, 20-22 November 2011
    • 2 URIs (bis)Bengaluru, 20-22 November 2011
    • REST follows a URI schema GET /users POST /users PUT /users/{id} DELETE /users/{id} ... Bengaluru, 20-22 November 2011
    • REST follows a URI schema GET /users POST /users PUT /users/{id} DELETE /users/{id} ... Bengaluru, 20-22 November 2011
    • what if you change your URL? Bengaluru, 20-22 November 2011
    • client isbroken Bengaluru, 20-22 November 2011
    • RESTful clients should be driven by services hypermedia controlsRoy Fielding : http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven Bengaluru, 20-22 November 2011
    • HATEOAS Bengaluru, 20-22 November 2011
    • 3POST is coolBengaluru, 20-22 November 2011
    • said SOAP 1.1 Bengaluru, 20-22 November 2011
    • said SOAP 1.1 Bengaluru, 20-22 November 2011
    • loosing meaningful verbs at the protocol level Bengaluru, 20-22 November 2011
    • loosing meaningful verbs at the protocol level nothing cacheable by default Bengaluru, 20-22 November 2011
    • loosing meaningful verbs at the protocol level nothing cacheable by default what about bookmarking? Bengaluru, 20-22 November 2011
    • 4500 is your friend Bengaluru, 20-22 November 2011
    • said SOAP ( again ) Bengaluru, 20-22 November 2011
    • GET /users/300Host: www.example.comBengaluru, 20-22 November 2011
    • GET /users/300 Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record cannot be found Bengaluru, 20-22 November 2011
    • GET /users/300 Host: www.example.comHTTP/1.1 500 Internal Server ErrorEtag: 1234X-Powered-By: php/5.3...The record cannot be found Bengaluru, 20-22 November 2011
    • The HTTP protocol is awesome,and lets you return meaningful anduniversally-understood status codes Bengaluru, 20-22 November 2011
    • 404 Not FoundBengaluru, 20-22 November 2011
    • 404 Not Found OMG Link is broken?Bengaluru, 20-22 November 2011
    • 202 AcceptedBengaluru, 20-22 November 2011
    • 202 AcceptedYou get an immediate OK, and the operation will hopefully complete Bengaluru, 20-22 November 2011
    • PauseBengaluru, 20-22 November 2011
    • The WWW Bengaluru, 20-22 November 2011
    • the largest data-exchange network on the planet Bengaluru, 20-22 November 2011
    • And meanwhile, at Facebook...12TB of new data every day (1 year ago) 500 million users Bengaluru, 20-22 November 2011
    • And meanwhile, at Google... 1 billionunique monthly googlers Bengaluru, 20-22 November 2011
    • via HTTP , baby! Bengaluru, 20-22 November 2011
    • HTTP in a nutshell:1. Client <> Server Bengaluru, 20-22 November 2011
    • HTTP in a nutshell: 2. Stateless Bengaluru, 20-22 November 2011
    • HTTP in a nutshell:3. widespread cache spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html Bengaluru, 20-22 November 2011
    • HTTP in a nutshell: Lao Tze Song using Firefox 6 Company proxy Great chinese (fire)wall Reverse proxy Origin server4. Layered system Bengaluru, 20-22 November 2011
    • HTTP in a nutshell: 5. it is the uniform interface between clients and servers Bengaluru, 20-22 November 2011
    • HTTP bleeds REST Bengaluru, 20-22 November 2011
    • How do Iimplement thisgoodness? Bengaluru, 20-22 November 2011
    • 1.caching & scalability Bengaluru, 20-22 November 2011
    • HTTP cache Bengaluru, 20-22 November 2011
    • Types of cache Local Shared/proxy Shared/reverse proxy Bengaluru, 20-22 November 2011
    • Types of cache Local Shared/proxy Shared/reverse proxy Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • Types of cache Local Shared/proxy Shared/reverse proxy Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • Types of cache Local Shared/proxyShared/reverse proxy Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • on the server sideBengaluru, 20-22 November 2011
    • Caching with Expiration (example) Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comExpires: 0 Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comExpires: 0 Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comExpires: Tue, 31 Jan 2011 01:00 GMT Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comCache-Control: max-age=60, public Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comCache-Control: max-age=60, public Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comCache-Control: max-age=60, public Cacheable for 60 seconds Bengaluru, 20-22 November 2011
    • HTTP/1.1 200 OKHost: www.example.comCache-Control: max-age=60, publicCacheable by both local and shared caches Bengaluru, 20-22 November 2011
    • You can also cache with validation(Etags, If-None-Match, ...) Bengaluru, 20-22 November 2011
    • Why HTTP caching is so important? Bengaluru, 20-22 November 2011
    • Ask yourself:as a developer, what do I want on my application? Bengaluru, 20-22 November 2011
    • Evolve Loose coupling Work lessBengaluru, 20-22 November 2011
    • EvolveBecause you want your platform to extensible Loose coupling Work less Bengaluru, 20-22 November 2011
    • EvolveBecause you want your platform to extensible Loose couplingBecause you want it to be easy to integrate with, evolve, plugand mantain Work less Bengaluru, 20-22 November 2011
    • EvolveBecause you want your platform to extensible Loose couplingBecause you want it to be easy to integrate with, evolve, plugand mantain Work lessBecause every LoC is bug-prone and our man-day is a hard-to-scale cost Bengaluru, 20-22 November 2011
    • enters our Hero #1Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • enters our Hero #2Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • http://www.lullabot.com/articles/a-beginners-guide-to-caching-data Bengaluru, 20-22 November 2011
    • 2007Bengaluru, 20-22 November 2011
    • 2011?Bengaluru, 20-22 November 2011
    • it supportsHTTP caching! http://drupal.org/node/147310 Bengaluru, 20-22 November 2011
    • it supportsHTTP caching! http://drupal.org/node/147310 ( people is supposed to clap their hands here ) Bengaluru, 20-22 November 2011
    • butBengaluru, 20-22 November 2011
    • wait.... how? Bengaluru, 20-22 November 2011
    • Default headersExpires = Sun, 19 Nov 1978 05:00:00 GMT,Cache-Control = no-cache, must-revalidate,ETag = $_SERVER[REQUEST_TIME], Bengaluru, 20-22 November 2011
    • Default headersExpires = Sun, 19 Nov 1978 05:00:00 GMT,Cache-Control = no-cache, must-revalidate,ETag = $_SERVER[REQUEST_TIME], Bengaluru, 20-22 November 2011
    • Default headersExpires = Sun, 19 Nov 1978 05:00:00 GMT,Cache-Control = no-cache, must-revalidate,ETag = $_SERVER[REQUEST_TIME], Bengaluru, 20-22 November 2011
    • Default headersExpires = Sun, 19 Nov 1978 05:00:00 GMT,Cache-Control = no-cache, must-revalidate,ETag = $_SERVER[REQUEST_TIME], Bengaluru, 20-22 November 2011
    • is that even legal?Bengaluru, 20-22 November 2011
    • "but you can redefine them!" Bengaluru, 20-22 November 2011
    • drupal_add_http_header() Bengaluru, 20-22 November 2011
    • function drupal_add_http_header(){ ... ... drupal_send_headers($headers);} Bengaluru, 20-22 November 2011
    • so, whatdrupal_send_headers() can do so evil? Bengaluru, 20-22 November 2011
    • header() , of course Bengaluru, 20-22 November 2011
    • which meansBengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, Im not);var_dump(headers_list()); Bengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, Im not);var_dump(headers_list());array 0 => string X-Powered-By: PHP/5.3.2-1ubuntu4.7 1 => string Dump-Header: Im not Bengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, false);var_dump(headers_list()); Bengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, false);var_dump(headers_list());array 0 => string X-Powered-By: PHP/5.3.2-1ubuntu4.7 1 => string Dump-Header: Im batman Bengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, );var_dump(headers_list()); Bengaluru, 20-22 November 2011
    • drupal_add_http_header(Dumb-Header, Im batman!);...// other logic...drupal_add_http_header(Dumb-Header, );var_dump(headers_list());array 0 => string X-Powered-By: PHP/5.3.2-1ubuntu4.7 1 => string Dumb-Header: Bengaluru, 20-22 November 2011
    • orBengaluru, 20-22 November 2011
    • you can use header_remove() ( PHP 5.3 ) Bengaluru, 20-22 November 2011
    • and create a new class to manage/keep track ofheaders and caching directives Bengaluru, 20-22 November 2011
    • but were lazy andwe dont want to reinvent the wheel Bengaluru, 20-22 November 2011
    • GoalsWork less evolve loose coupling Bengaluru, 20-22 November 2011
    • GoalsWork less evolve loose coupling Bengaluru, 20-22 November 2011
    • everything is done for us! :) but.... Bengaluru, 20-22 November 2011
    • tmp files, cache tables, procedural code... mmmmh.... gotta be something better Bengaluru, 20-22 November 2011
    • FrameworksBengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • ONEBengaluru, 20-22 November 2011
    • Cache is used for compiling routes, autoloading, ... Bengaluru, 20-22 November 2011
    • Cache is used for compiling routes, autoloading, ... ...but also for storing the view Bengaluru, 20-22 November 2011
    • GoalsWork less evolve loose coupling Bengaluru, 20-22 November 2011
    • GoalsWork less evolve loose coupling Bengaluru, 20-22 November 2011
    • at least because we use a framework Bengaluru, 20-22 November 2011
    • HTTP
    • Less workBengaluru, 20-22 November 2011
    • http://www.flickr.com/photos/snakphotography/5004775320/sizes/o/in/photostream/ because the hard work is delegated to the browser/proxy Bengaluru, 20-22 November 2011
    • EvolveBengaluru, 20-22 November 2011
    • because cache is abstracted from the application Bengaluru, 20-22 November 2011
    • Loose coupling Bengaluru, 20-22 November 2011
    • because caching is bound to the protocol, HTTP, notto your implementation ( Sf, RoR, Django ) Bengaluru, 20-22 November 2011
    • but hey, you sayBengaluru, 20-22 November 2011
    • HTTPs cache fails when dealing with really dynamicpages, because consumers will always have to hit the origin server, although a part of the page would be cacheable ( header and footer, for example ) Bengaluru, 20-22 November 2011
    • Nope NopeBengaluru, 20-22 November 2011
    • ESI was built for that http://www.w3.org/TR/esi-lang Bengaluru, 20-22 November 2011
    • Edge Side Includes A de facto standard for bla bla bla... Bengaluru, 20-22 November 2011
    • 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
    • <esi:include src="http://osidays.com/talks/1" /> Bengaluru, 20-22 November 2011
    • <esi:include src="http://osidays.com/talks/1" /> Bengaluru, 20-22 November 2011
    • <esi:include src="http://osidays.com/talks/1" /> Bengaluru, 20-22 November 2011
    • 1s (tweets)3600 (post) Bengaluru, 20-22 November 2011
    • <esi:include src=tweets.html /><esi:include src=article/12.html /> Bengaluru, 20-22 November 2011
    • 2.adaptability & durability Bengaluru, 20-22 November 2011
    • Hypermedia another long-time friend Bengaluru, 20-22 November 2011
    • Linksoutrageously semplifying Bengaluru, 20-22 November 2011
    • <img src="..." /><a href="..." /><link rel="payment" ... /> Bengaluru, 20-22 November 2011
    • <img src="..." /><a href="..." /><link rel="payment" ... /> Bengaluru, 20-22 November 2011
    • <img src="..." /><a href="..." /><link rel="payment" ... /> Bengaluru, 20-22 November 2011
    • <link rel="payment" href="/checkout" type="text/html" ... /> Bengaluru, 20-22 November 2011
    • <link rel="payment" href="/checkout" type="text/html" ... /> Bengaluru, 20-22 November 2011
    • <link rel="payment" href="/checkout" type="text/html" ... /> Bengaluru, 20-22 November 2011
    • <link rel="payment" href="/checkout" type="text/html" ... /> Bengaluru, 20-22 November 2011
    • POST /users Host: www.example. comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /users/1 Bengaluru, 20-22 November 2011
    • POST /users Host: www.example. comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /users/1 Bengaluru, 20-22 November 2011
    • POST /users Host: www.example. comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /new-users-db/1 Bengaluru, 20-22 November 2011
    • POST /users Host: www.example. comHTTP/1.1 201 CreatedHost: www.example.comEtag: 1234X-Powered-By: php/5.3Location: /new-users-db/1 Bengaluru, 20-22 November 2011
    • consumers of your API are able to follow the changes of your design Bengaluru, 20-22 November 2011
    • Client knows how to consume theservice based on the informationsauto-provided by the service itself Bengaluru, 20-22 November 2011
    • No WSDL.Bengaluru, 20-22 November 2011
    • No URI templates.Bengaluru, 20-22 November 2011
    • No easily-outdated documentation. Bengaluru, 20-22 November 2011
    • No assumptions.Bengaluru, 20-22 November 2011
    • Less WTFs.Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • This does not easily break. Bengaluru, 20-22 November 2011
    • HATEOASHypermedia As The Engine Of Application State Bengaluru, 20-22 November 2011
    • 6Bengaluru, 20-22 November 2011
    • everythingseems eventually coolRecap: why REST? Bengaluru, 20-22 November 2011
    • ProsPerformances Bengaluru, 20-22 November 2011
    • ProsScalability Bengaluru, 20-22 November 2011
    • Pros DurabilityBengaluru, 20-22 November 2011
    • Not RESTful? Bengaluru, 20-22 November 2011
    • Simply dont care Bengaluru, 20-22 November 2011
    • Rules of architectural design Bengaluru, 20-22 November 2011
    • Follow them according to your needs Bengaluru, 20-22 November 2011
    • amazon.comBengaluru, 20-22 November 2011
    • So...Bengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • Alessandro Nadalin Bengaluru, 20-22 November 2011
    • odino.orgBengaluru, 20-22 November 2011
    • Bengaluru, 20-22 November 2011
    • @_odino_ #osidaysBengaluru, 20-22 November 2011
    • Thank YOU!@_odino_ Bengaluru, 20-22 November 2011
    • 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/ Bengaluru, 20-22 November 2011