SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
REST, Reuse, and
  Serendipity
       Steve Vinoski
    Member of Technical Staff
           Verivue
      Westford, MA USA
      QCon London 2008
serendipity (noun): the
occurrence and development
of events by chance in a
happy or beneficial way.
Motivation
•   Many folks in the web world already
    understand the capabilities and power of REST

    •   if this describes you, this talk may bore you

•   But to many involved in enterprise integration
    and middleware, REST is entirely new and
    misunderstood

    •   this talk is for you
Enterprise Integration
Some Solutions
•   Descendants of Remote Procedure Call (RPC)

    •   CORBA, EJB, .NET, SCA

    •   SOAP, WSDL, WS-*

•   Enterprise messaging

    •   Messaging queuing

    •   Enterprise Application Integration (EAI)
Problems with MQ

• Generally proprietary, except for:
 • JMS: open messaging interfaces
 • AMQP: open messaging protocol (and
    open source Apache implementation)
• Can be expensive
Problems with EAI
• EAI systems are typically:
 • proprietary and expensive
 • centralized hubs
 • costly to customize and maintain
• Some ESBs have fallen into this category
 • old EAI products re-labeled
Problems with RPC
     Approaches
• Focus on language first
 • tries to fit the distributed system to the
    language, not vice-versa
• Tries to make distributed calls appear local
 • ignores partial failure and latency issues
• Exposes language-specific objects directly
  as language-independent services
More RPC Problems
• Code generation
 • traditionally, stub code generated from a
    definition language, e.g. IDL or WSDL
  • today WSDL is often reverse-generated
    from annotated language definitions
• Both approaches can create deceptively
  significant consumer-service coupling
Type System Illusions
• RPC-oriented systems offer the illusion of
  type safety
  • define interface types
  • define data types to pass via methods
• But there is no type safety across the wire
• This type specialization is costly for
  scalability and reuse
Interfaces are Protocols
• In RPC-oriented systems, a new service
  interface is a new application protocol
 • consumers hard-code knowledge of
    method names and semantics
 • consumers must inherently know which
    method to call, possibly in what order
 • no semantic constraints on methods
Data Specialization
• RPC-oriented systems encourage
  specialized data definitions
 • same as defining regular classes/methods
• Using XML is better than using IDL types
  or programming language types
 • but benefits disappear if you generate
    code from it
Integration Problem
       Summary
• Proprietary approaches too expensive
• Standard approaches focus on
  implementation languages, not distributed
  systems issues
• New interface == new application protocol
• Ad hoc data formats coupled to interfaces
• All these problems inhibit reuse
A Detour: UNIX Reuse
• Consider the UNIX shell pipe
 • chain output of one tool to input of
    another
 • old tools and new can interact, even
    though independently developed
 • easily combine existing tools into new
    ones
UNIX Pipes
•   The pipe is based on two key features

    •   the uniform interface of the “file-like object”

    •   the standard file descriptor framework for
        applications: stdin, stdout, stderr

•   Standard ways to get data to/from applications

•   The pipe results from modularity and simplicity
    (and serendipity, perhaps?)
REST’s Uniform
  Interface Constraint
• Generalized resource interface
 • in HTTP, methods are the protocol verbs
  Method          Purpose              Idempotent?
                                             Yes
             Retrieve resource state
    GET          representation         (no side effects)
             Provide resource state
    PUT                                      Yes
                 representation
              Create or extend a
   POST                                      No
                    resource

  DELETE                                     Yes
               Delete a resource
Uniform Interface
         Benefits
• Enables visibility into interactions
 • including caching, monitoring, mediation
    applicable across all resources
• Provides strong implementation hiding,
  independent evolvability
• Simplified overall architecture
Generic Invocation
•   The uniform interface makes reusable generic
    invocation libraries possible
    •   python urllib, urllib2, httplib, httplib2
    •   curl command-line tool
    •   many others, in many languages
•   Server-side dispatching simplified as well
•   No need for generated code
Four Sub-Constraints
• Resource identification via URIs
• Resource manipulation through the
  exchange of resource state representations
• Self-describing messages with potentially
  multiple representation formats
• Hypermedia as the engine of application
  state (HATEOAS, or hypermedia constraint)
Representations

• Method payloads are representations of
  resource state
• Methods often support multiple
  representation formats
• Representation format is not method-
  specific as with RPC-oriented approaches
Media Types
• Representation formats identified using
  media (MIME) types
• These types are standardized/registered
  through the IANA (http://www.iana.org/
  assignments/media-types/)
• Allows reusable libraries and tools to
  handle various MIME types
Hypermedia Constraint
• Resources keep resource state, clients keep
  application state
• Resources provide URIs in their state to
  guide clients through the application state
• Clients need “know” only a single URI to
  enter an application, can get other needed
  URIs from resource representations
Separation of Concerns
•   RPC-oriented systems conflate methods and
    data
    •   Many ad hoc methods and data types, but
        just a single data format on the wire
•   REST separates methods and data formats

    •   Fixed set of methods, many standardized
        data formats, multiple formats possible per
        method
Enhancing Reuse
       Possibilities
• Separating concerns
 • libraries/tools for dealing with methods
 • separate libs/tools for dealing with data
• Uniformity
 • libraries for caching
 • libraries for interception and mediation
For Example
•   Consider a bug-tracking system

    •   HTML representations for interactive viewing,
        additions, modifications

    •   Excel or CSV representations for statistical tracking
        by importing into other tools

    •   XML (e.g. AtomPub) or JSON to allow use by other
        tools, for extensions and integration

    •   Atom feeds for watching bug activity

•   Existing clients that understand these formats can easily
    adapt to use them
Independence
• Each of the resources and formats on the
  previous page could be added
  independently without disturbing existing
  resource and formats
• You might add them “just because,” without
  an immediate need
 • plant the seeds to see what grows
Summary
•   RPC-oriented systems try to extend programming
    language paradigms over the wire

    •   encourages variation, which can’t scale

•   REST is purpose-built for distributed systems

    •   properly separates concerns and allows
        constrained variability only where required

    •   encourages combinations of orthogonal
        solutions into larger applications
Engineer for serendipity.
                  Roy T. Fielding
For More Information
•   Fielding’s thesis
    •   http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

•   Read various blogs: Mark Baker, Bill de hÓra, Joe Gregorio, Paul
    Downey, Benjamin Carlyle, Stu Charlton, Mark Nottingham

•   Sign up to the rest-discuss Yahoo mailing list

•   My “Toward Integration” columns in IEEE Internet Computing (all
    columns are available from http://steve.vinoski.net/), for example:

    •   Serendipitous Reuse (Jan/Feb 2008)

    •   Demystifying RESTful Data Coupling (Mar/Apr 2008)

Mais conteúdo relacionado

Semelhante a Rest Reuse And Serendipity

ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawnozten
 
RESTful Approaches to Financial Systems Integration
RESTful Approaches to Financial Systems IntegrationRESTful Approaches to Financial Systems Integration
RESTful Approaches to Financial Systems IntegrationKirkWylie
 
Programming Language Selection
Programming Language SelectionProgramming Language Selection
Programming Language SelectionDhananjay Nene
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketScott Abel
 
Apache Thrift, a brief introduction
Apache Thrift, a brief introductionApache Thrift, a brief introduction
Apache Thrift, a brief introductionRandy Abernethy
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Marian Marinov
 
Module: Mutable Content in IPFS
Module: Mutable Content in IPFSModule: Mutable Content in IPFS
Module: Mutable Content in IPFSIoannis Psaras
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerTed Leung
 
Enterprise Perl
Enterprise PerlEnterprise Perl
Enterprise PerlDave Cross
 
200211 Fielding Apachecon
200211 Fielding Apachecon200211 Fielding Apachecon
200211 Fielding ApacheconDaniel Parker
 
Petapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated SystemsPetapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated Systemsdairsie
 
Some news about the SW
Some news about the SWSome news about the SW
Some news about the SWIvan Herman
 
Cross-platform interaction
Cross-platform interactionCross-platform interaction
Cross-platform interactionOleksii Duhno
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesSteve Speicher
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OSri Ambati
 

Semelhante a Rest Reuse And Serendipity (20)

Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Integrating RESTfully
Integrating RESTfullyIntegrating RESTfully
Integrating RESTfully
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 
RESTful Approaches to Financial Systems Integration
RESTful Approaches to Financial Systems IntegrationRESTful Approaches to Financial Systems Integration
RESTful Approaches to Financial Systems Integration
 
Programming Language Selection
Programming Language SelectionProgramming Language Selection
Programming Language Selection
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
 
Apache Thrift, a brief introduction
Apache Thrift, a brief introductionApache Thrift, a brief introduction
Apache Thrift, a brief introduction
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?
 
Module: Mutable Content in IPFS
Module: Mutable Content in IPFSModule: Mutable Content in IPFS
Module: Mutable Content in IPFS
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of Chandler
 
Enterprise Perl
Enterprise PerlEnterprise Perl
Enterprise Perl
 
200211 Fielding Apachecon
200211 Fielding Apachecon200211 Fielding Apachecon
200211 Fielding Apachecon
 
Qcon
QconQcon
Qcon
 
Petapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated SystemsPetapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated Systems
 
Some news about the SW
Some news about the SWSome news about the SW
Some news about the SW
 
Cross-platform interaction
Cross-platform interactionCross-platform interaction
Cross-platform interaction
 
Overview of ESB at Azilen Tech Meetup
Overview of ESB at Azilen Tech MeetupOverview of ESB at Azilen Tech Meetup
Overview of ESB at Azilen Tech Meetup
 
Introduction
IntroductionIntroduction
Introduction
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open Interfaces
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2O
 

Mais de QConLondon2008

J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The JvmQConLondon2008
 
Market Risk System Bnp Paribas
Market Risk System Bnp ParibasMarket Risk System Bnp Paribas
Market Risk System Bnp ParibasQConLondon2008
 
Evolving The Java Language
Evolving The Java LanguageEvolving The Java Language
Evolving The Java LanguageQConLondon2008
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebQConLondon2008
 
14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns ConcreteQConLondon2008
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1QConLondon2008
 
Application Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomApplication Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomQConLondon2008
 

Mais de QConLondon2008 (11)

J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The Jvm
 
Agile Mashups
Agile MashupsAgile Mashups
Agile Mashups
 
Market Risk System Bnp Paribas
Market Risk System Bnp ParibasMarket Risk System Bnp Paribas
Market Risk System Bnp Paribas
 
A Tale Of Two Systems
A Tale Of Two SystemsA Tale Of Two Systems
A Tale Of Two Systems
 
Evolving The Java Language
Evolving The Java LanguageEvolving The Java Language
Evolving The Java Language
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The Web
 
14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1
 
Application Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomApplication Services On The Web Sales Forcecom
Application Services On The Web Sales Forcecom
 
Managers In Scrum
Managers In ScrumManagers In Scrum
Managers In Scrum
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Rest Reuse And Serendipity

  • 1. REST, Reuse, and Serendipity Steve Vinoski Member of Technical Staff Verivue Westford, MA USA QCon London 2008
  • 2. serendipity (noun): the occurrence and development of events by chance in a happy or beneficial way.
  • 3. Motivation • Many folks in the web world already understand the capabilities and power of REST • if this describes you, this talk may bore you • But to many involved in enterprise integration and middleware, REST is entirely new and misunderstood • this talk is for you
  • 5. Some Solutions • Descendants of Remote Procedure Call (RPC) • CORBA, EJB, .NET, SCA • SOAP, WSDL, WS-* • Enterprise messaging • Messaging queuing • Enterprise Application Integration (EAI)
  • 6. Problems with MQ • Generally proprietary, except for: • JMS: open messaging interfaces • AMQP: open messaging protocol (and open source Apache implementation) • Can be expensive
  • 7. Problems with EAI • EAI systems are typically: • proprietary and expensive • centralized hubs • costly to customize and maintain • Some ESBs have fallen into this category • old EAI products re-labeled
  • 8. Problems with RPC Approaches • Focus on language first • tries to fit the distributed system to the language, not vice-versa • Tries to make distributed calls appear local • ignores partial failure and latency issues • Exposes language-specific objects directly as language-independent services
  • 9. More RPC Problems • Code generation • traditionally, stub code generated from a definition language, e.g. IDL or WSDL • today WSDL is often reverse-generated from annotated language definitions • Both approaches can create deceptively significant consumer-service coupling
  • 10. Type System Illusions • RPC-oriented systems offer the illusion of type safety • define interface types • define data types to pass via methods • But there is no type safety across the wire • This type specialization is costly for scalability and reuse
  • 11. Interfaces are Protocols • In RPC-oriented systems, a new service interface is a new application protocol • consumers hard-code knowledge of method names and semantics • consumers must inherently know which method to call, possibly in what order • no semantic constraints on methods
  • 12. Data Specialization • RPC-oriented systems encourage specialized data definitions • same as defining regular classes/methods • Using XML is better than using IDL types or programming language types • but benefits disappear if you generate code from it
  • 13. Integration Problem Summary • Proprietary approaches too expensive • Standard approaches focus on implementation languages, not distributed systems issues • New interface == new application protocol • Ad hoc data formats coupled to interfaces • All these problems inhibit reuse
  • 14. A Detour: UNIX Reuse • Consider the UNIX shell pipe • chain output of one tool to input of another • old tools and new can interact, even though independently developed • easily combine existing tools into new ones
  • 15. UNIX Pipes • The pipe is based on two key features • the uniform interface of the “file-like object” • the standard file descriptor framework for applications: stdin, stdout, stderr • Standard ways to get data to/from applications • The pipe results from modularity and simplicity (and serendipity, perhaps?)
  • 16. REST’s Uniform Interface Constraint • Generalized resource interface • in HTTP, methods are the protocol verbs Method Purpose Idempotent? Yes Retrieve resource state GET representation (no side effects) Provide resource state PUT Yes representation Create or extend a POST No resource DELETE Yes Delete a resource
  • 17. Uniform Interface Benefits • Enables visibility into interactions • including caching, monitoring, mediation applicable across all resources • Provides strong implementation hiding, independent evolvability • Simplified overall architecture
  • 18. Generic Invocation • The uniform interface makes reusable generic invocation libraries possible • python urllib, urllib2, httplib, httplib2 • curl command-line tool • many others, in many languages • Server-side dispatching simplified as well • No need for generated code
  • 19. Four Sub-Constraints • Resource identification via URIs • Resource manipulation through the exchange of resource state representations • Self-describing messages with potentially multiple representation formats • Hypermedia as the engine of application state (HATEOAS, or hypermedia constraint)
  • 20. Representations • Method payloads are representations of resource state • Methods often support multiple representation formats • Representation format is not method- specific as with RPC-oriented approaches
  • 21. Media Types • Representation formats identified using media (MIME) types • These types are standardized/registered through the IANA (http://www.iana.org/ assignments/media-types/) • Allows reusable libraries and tools to handle various MIME types
  • 22. Hypermedia Constraint • Resources keep resource state, clients keep application state • Resources provide URIs in their state to guide clients through the application state • Clients need “know” only a single URI to enter an application, can get other needed URIs from resource representations
  • 23. Separation of Concerns • RPC-oriented systems conflate methods and data • Many ad hoc methods and data types, but just a single data format on the wire • REST separates methods and data formats • Fixed set of methods, many standardized data formats, multiple formats possible per method
  • 24. Enhancing Reuse Possibilities • Separating concerns • libraries/tools for dealing with methods • separate libs/tools for dealing with data • Uniformity • libraries for caching • libraries for interception and mediation
  • 25. For Example • Consider a bug-tracking system • HTML representations for interactive viewing, additions, modifications • Excel or CSV representations for statistical tracking by importing into other tools • XML (e.g. AtomPub) or JSON to allow use by other tools, for extensions and integration • Atom feeds for watching bug activity • Existing clients that understand these formats can easily adapt to use them
  • 26. Independence • Each of the resources and formats on the previous page could be added independently without disturbing existing resource and formats • You might add them “just because,” without an immediate need • plant the seeds to see what grows
  • 27. Summary • RPC-oriented systems try to extend programming language paradigms over the wire • encourages variation, which can’t scale • REST is purpose-built for distributed systems • properly separates concerns and allows constrained variability only where required • encourages combinations of orthogonal solutions into larger applications
  • 28. Engineer for serendipity. Roy T. Fielding
  • 29. For More Information • Fielding’s thesis • http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm • Read various blogs: Mark Baker, Bill de hÓra, Joe Gregorio, Paul Downey, Benjamin Carlyle, Stu Charlton, Mark Nottingham • Sign up to the rest-discuss Yahoo mailing list • My “Toward Integration” columns in IEEE Internet Computing (all columns are available from http://steve.vinoski.net/), for example: • Serendipitous Reuse (Jan/Feb 2008) • Demystifying RESTful Data Coupling (Mar/Apr 2008)