SlideShare une entreprise Scribd logo
1  sur  116
Understanding the Role
  of Media Types in
 RESTful Applications


   Jan Algermissen / @algermissen
      GOTO Copenhagen 2011
Application
Application
User
Application   Use Case
Application


              Application
Monolithic
User
       Monolithic
Monolithic
             Use Case
Monolithic

Application
Monolithic




Components
Monolithic


             Connectors
Unix Command Line
User   Unix Command Line
Unix Command Line Use Case
Unix Command Line
               Application
Unix Command Line




    Components
Unix Command Line




     Connectors
Network-Based (ODBC)
User
       Network-Based (ODBC)
Network-Based (ODBC)Use Case
Network-Based (ODBC)

                   Application
Network-Based (ODBC)




        Components
Network-Based (ODBC)




  Connector
Network-Based (ODBC)
Network-Based (ODBC)
    User
Network-Based (ODBC)
              Use Case
Network-Based (ODBC)

                  Application
Network-Based (ODBC)




          Components
Network-Based (ODBC)




 Connector
Network-Based (HTTP)
User   Network-Based (HTTP)
Network-Based (HTTP)
               Use Case
Network-Based (HTTP)

                Application
Network-Based (HTTP)



User Agent Component




     Intermediary Component   Server Component
Network-Based (HTTP)




          Connectors
Network-Based (HTTP)
User
  Network-Based (HTTP)
Network-Based (HTTP)
              Use Case
Network-Based (HTTP)
                   Application
Network-Based (HTTP)


User Agent Component




    Intermediary Component   Server Component
Network-Based (HTTP)




          Connectors
Network-Based (HTTP)


              Administrative Domain
Issues of
network-based,
 decentralized
    systems
Network




   Issues of
network-based,
 decentralized
    systems
Network

                 Unpredictable
                     Use

   Issues of
network-based,
 decentralized
    systems
Network

                   Unpredictable
                       Use

   Issues of
network-based,
 decentralized
    systems



                 Complexity
Network

                           Unpredictable
                               Use

           Issues of
        network-based,
         decentralized
            systems



Trust                    Complexity
Network

Federated                        Unpredictable
 Change                              Use

                 Issues of
              network-based,
               decentralized
                  systems



      Trust                    Complexity
Performance
                 Network

Federated                        Unpredictable
 Change                              Use

                 Issues of
              network-based,
               decentralized
                  systems



      Trust                    Complexity
Performance
                 Network
                                 Scalability
Federated                        Unpredictable
 Change                              Use

                 Issues of
              network-based,
               decentralized
                  systems



      Trust                    Complexity
Performance
                 Network
                                  Scalability
Federated                        Unpredictable
 Change                              Use

                 Issues of
              network-based,
               decentralized
                  systems



      Trust                    Complexity
                               Simplicity
Performance
                    Network
                                     Scalability
Federated                           Unpredictable
 Change                                 Use

                    Issues of
                 network-based,
                  decentralized
                     systems



      Trust                       Complexity
    Visibility                    Simplicity
Performance
                     Network
Evolvability                          Scalability
 Federated                           Unpredictable
  Change                                 Use

                     Issues of
                  network-based,
                   decentralized
                      systems



        Trust                      Complexity
     Visibility                    Simplicity
Performance
 Scalability
 Simplicity
  Visibility
Evolvability
Properties of Key Interest
        Performance
         Scalability
         Simplicity
          Visibility
         Evolvability
Evolvability
GOAL
Server owner can implement any change
     without asking existing clients.
Client   Contract
                    Server
Contract




Client              Server
Contract   Media Type




Client                   Server
Media Type
Media Type

1.What is a media type?
Media Type

1.What is a media type?
2.How do I design one?
Media Type

1.What is a media type?
2.How do I design one?
3.How do media types enable evolvability?
1. What is a media type?
1. What is a media type?

•A name (identifier)
1. What is a media type?

•A name (identifier)
•A family of compatible schemas
1. What is a media type?

•A name (identifier)
•A family of compatible schemas
•Hypermedia semantics
1. What is a media type?

•A name (identifier)
•A family of compatible schemas
•Hypermedia semantics
•Processing rules
1. What is a media type?

•A name (identifier)
•A family of compatible schemas
•Hypermedia semantics
•Processing rules
•Extension rules
2. How do I design a
    media type?
Automatically check
             prices and place order if
             price is below threshold
  User




                      Shop A

User Agent
(Crawler)

                      Shop B
UC 01: Automatically check prices and...
Primary Actor: User (Buyer)
Precondition: Crawler knows catalog entry URIs
Main Success Scenario:
1. User starts crawler
2. Crawler requests catalogs of known shops
3. Crawler compares prices of items to threshold
4. Crawler selects item if price below threshold
5. Crawler creates order for item
6. Crawler submits order to order-processor
7. Crawler archives order response
8. User reviews archived order responses
UC 01: Automatically check prices and...
Primary Actor: User (Buyer)
Precondition: Crawler knows catalog entry URIs
Main Success Scenario:
1. User starts crawler
2. Crawler requests catalogs of known shops
3. Crawler compares prices of items to threshold
4. Crawler selects item if price below threshold
5. Crawler creates order for item
6. Crawler submits order to order-processor
7. Crawler archives order response
8. User reviews archived order responses
Elements of Example
    Media Type
 Data:
 Catalog (with items)
 Order (with order-items)
 Order Response

 Hypermedia controls:
 Order-Processor
 (Catalog)
Catalog Example

<catalog>
  <title>Shoe Catalog</title>
  <order-processor href="/orders"/>
  <item id=”123” href=”/items/23”>
    <name>Shiny Boots</name>
    <price currency="EUR" amount="27.99">
  </item>
  <item id=”456” href=”/items/388”>
    <name>Fancy Sneakers</name>
    <price currency="EUR" amount="12.95">
  </item>
</catalog>
Order Example

<order>
  <buyer>...</buyer>
  <line-items>
    <line-item id=”123”>
      <price currency=”EUR”>27.99</price>
      <quantity>4</quantity>
    </line-item>
    <line-item id=”456”>
      <price currency=”EUR”>12.95</price>
      <quantity>4</quantity>
    </line-item>
  </line-items>
</order>
application/procurement
•Three schemas <catalog>, <order> and
<order-response>
•No mandatory elements
•Extensible
•Specified as version 1
•Processing Rules
 If an <order-processor> element is present an order can be POSTed to that resource.
 Such an oder accepting resource SHOULD accept <order>-documents.
 ...
3.How does a media type
   enable evolvability?
3.How does a media type
   enable evolvability?
          Contract   Media Type




 Client                   Server
Shop Service

@GET
@Produces("application/procurement")
public String makeProcurementCatalog() {

    return "<catalog/>";
}
Catalog Example

<catalog>
  <title>Shoe Catalog</title>
  <order-processor href="/orders"/>
  <item id=”123” href=”/items/23”>
    <name>Shiny Boots</name>
    <price currency="EUR" amount="27.99">
  </item>
  <item id=”456” href=”/items/388”>
    <name>Fancy Sneakers</name>
    <price currency="EUR" amount="12.95">
  </item>
</catalog>
Shop Service (improved)

@GET
@Produces("application/procurement")
public Catalog makeProcurementCatalog() {

    Catalog catalog = new Catalog(“Shoe Catalog”);
    catalog.setOrderProcessor("/orders");
    catalog.addItem("/items/23","Shiny Boots","27.99");
    catalog.addItem("/items/388","Fancy Sneakers","12.95");

    return catalog;
}
Server Development Principle


      Design by purpose
Crawler Implementation
public void handleCatalog(catalogUri) {

      WebResource resource =
          getClient().resource(catalogUri);
      ClientResponse response =
          resource.get(ClientResponse.class);

      Catalog catalog = response.getEntity(Catalog.class);
      Item item = catalog.getItemById(“123”);
      if(item != null && item.getPrice() != null
          && item.getPrice().getAmount(“EUR”) < THRESHOLD) {
         placeOrder(catalog,item);
      }

  }
Crawler Impl. (cont.)
public void placeOrder(Catalog catalog, Item item) {

      String orderProcessorUri = catalog.getOrderProcessorUri();
      Order order = new Order(item);

      WebResource resource =
            getClient().resource(orderProcessorUri);
      ClientResponse response =
          resource.post(ClientResponse.class,order);

      // handle order placement response

  }
Client Development Principle


       Design by intent
Observation

REST limits the possible contract
changes to just two kinds: Adding
data or controls and removing data or
controls from a message.
New Requirement


Add in-stock quantity
Extended Catalog Example
GET /catalog

200 Ok
Content-Type: application/procurement

<catalog>
  <title>Shoe Catalog</title>
  <order-processor href="/orders"/>
  <item id=”123” href=”/items/23”>
    <name>Shiny Boots</name>
    <price currency="EUR" amount="27.99">
    <in-stock>5</in-stock>
  </item>
  <item id=”456” href=”/items/388”>
    <name>Fancy Sneakers</name>
    <price currency="EUR" amount="12.95">
    <in-stock>2</in-stock>
  </item>
</catalog>
Media Type Principle


 Extensible schemas
Client Development Principle


        “Must Ignore”
Share Useful Extensions

Feed extensions back into
media type, increase schema
version.
Shop Server Change



No order processor available
Catalog Example
GET /catalog

200 Ok
Content-Type: application/procurement

<catalog>
  <title>Shoe Catalog</title>

  <item id=”123” href=”/items/23”>
    <name>Shiny Boots</name>
    <price currency="EUR" amount="27.99">
  </item>
  <item id=”456” href=”/items/388”>
    <name>Fancy Sneakers</name>
    <price currency="EUR" amount="12.95">
  </item>
</catalog>
Crawler Impl. (fails)
public void placeOrder(Catalog catalog, Item item) {

      String orderProcessorUri = catalog.getOrderProcessorUri();
      Order order = new Order(item);

      WebResource resource =
            getClient().resource(orderProcessorUri);
      ClientResponse response =
          resource.post(ClientResponse.class,order);

      // handle order placement response

  }
Crawler Impl. (improved)
public void placeOrder(Client Response response,
                                Catalog catalog, Item item) {

      String orderProcessorUri = catalog.getOrderProcessorUri();
      if(orderProcessorUri == null) {
        throw new FailedExpectationException(
             “Expected order processor not found”,response);
      }
      Order order = new Order(item);

      WebResource resource =
            getClient().resource(orderProcessorUri);
      ClientResponse response =
          resource.post(ClientResponse.class,order);

      // handle order placement response

  }
Crawler Impl. (improved)
try {
    handleCatalog(catalogUri);
} catch(FailedExpectationException e) {
    String message = e.getMessage();
    ClientResponse response = e.getClientResponse();

    LOG.error( ... );

    reportIncident(
        “Failed expectation when processing catalog ” +
        catalogUri,
        message, response, PRIORITY_CRITICAL);

    // ...
}
Client Development Principle


 “What if” programming style
Media Type Principle


Avoid mandatory elements
Server Development Principle


       Be responsible
If you are a media type
       designer...
If you are a media type
       designer...

 •Define extensible schemas
If you are a media type
       designer...

 •Define extensible schemas
 •Avoid mandatory elements
If you are a server
    developer...
If you are a server
            developer...

•Use from the media type what suits your
possibilities
If you are a server
           developer...

•Use from the media type what suits your
possibilities
•Be responsible and maintain things
If you are a client developer...
If you are a client developer...

•Use from the media type what suits your
intended application
If you are a client developer...

•Use from the media type what suits your
intended application
•Ignore unknown data and controls
If you are a client developer...

•Use from the media type what suits your
intended application
•Ignore unknown data and controls
•“What if” programming style
Server does not own
    the contract
Flexible Contract
Source of information
Q&A

Contenu connexe

Similaire à Understanding the Role of Media Types in RESTful applications

Dependency Injection & IoC
Dependency Injection & IoCDependency Injection & IoC
Dependency Injection & IoC
Dennis Loktionov
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles
Majong DevJfu
 

Similaire à Understanding the Role of Media Types in RESTful applications (20)

Reducing Cost with DNA Automation
Reducing Cost with DNA AutomationReducing Cost with DNA Automation
Reducing Cost with DNA Automation
 
Nagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - MerlinNagios Conference 2012 - Andreas Ericsson - Merlin
Nagios Conference 2012 - Andreas Ericsson - Merlin
 
Software System Scalability: Concepts and Techniques (keynote talk at ISEC 2009)
Software System Scalability: Concepts and Techniques (keynote talk at ISEC 2009)Software System Scalability: Concepts and Techniques (keynote talk at ISEC 2009)
Software System Scalability: Concepts and Techniques (keynote talk at ISEC 2009)
 
Private cloud day session 5 a solution for private cloud security
Private cloud day session 5 a solution for private cloud securityPrivate cloud day session 5 a solution for private cloud security
Private cloud day session 5 a solution for private cloud security
 
Dependency Injection & IoC
Dependency Injection & IoCDependency Injection & IoC
Dependency Injection & IoC
 
Iot cloud service v2.0
Iot cloud service v2.0Iot cloud service v2.0
Iot cloud service v2.0
 
Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...
Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...
Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...
 
Sdn primer pdf
Sdn primer pdfSdn primer pdf
Sdn primer pdf
 
6° Sessione VMware NSX: la piattaforma di virtualizzazione della rete per il ...
6° Sessione VMware NSX: la piattaforma di virtualizzazione della rete per il ...6° Sessione VMware NSX: la piattaforma di virtualizzazione della rete per il ...
6° Sessione VMware NSX: la piattaforma di virtualizzazione della rete per il ...
 
Simplifying SDN Networking Across Private and Public Clouds
Simplifying SDN Networking Across Private and Public CloudsSimplifying SDN Networking Across Private and Public Clouds
Simplifying SDN Networking Across Private and Public Clouds
 
infraxstructure: Emil Gągała "Ludzie, procesy, technika – czy wirtualizacja ...
infraxstructure: Emil Gągała  "Ludzie, procesy, technika – czy wirtualizacja ...infraxstructure: Emil Gągała  "Ludzie, procesy, technika – czy wirtualizacja ...
infraxstructure: Emil Gągała "Ludzie, procesy, technika – czy wirtualizacja ...
 
Revealing the State of Network Configuration Management & Automation in the E...
Revealing the State of Network Configuration Management & Automation in the E...Revealing the State of Network Configuration Management & Automation in the E...
Revealing the State of Network Configuration Management & Automation in the E...
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles
 
Mini-Track: Lessons from Public Cloud
Mini-Track: Lessons from Public CloudMini-Track: Lessons from Public Cloud
Mini-Track: Lessons from Public Cloud
 
Visualizing Your Network Health - Driving Visibility in Increasingly Complex...
Visualizing Your Network Health -  Driving Visibility in Increasingly Complex...Visualizing Your Network Health -  Driving Visibility in Increasingly Complex...
Visualizing Your Network Health - Driving Visibility in Increasingly Complex...
 
null Bangalore meet - Cloud Computing and Security
null Bangalore meet - Cloud Computing and Securitynull Bangalore meet - Cloud Computing and Security
null Bangalore meet - Cloud Computing and Security
 
Grid Middleware – Principles, Practice and Potential
Grid Middleware – Principles, Practice and PotentialGrid Middleware – Principles, Practice and Potential
Grid Middleware – Principles, Practice and Potential
 
Computer networks : intro to networking, pros and cons, uses, network edges :...
Computer networks : intro to networking, pros and cons, uses, network edges :...Computer networks : intro to networking, pros and cons, uses, network edges :...
Computer networks : intro to networking, pros and cons, uses, network edges :...
 
Application architecture for cloud
Application architecture for cloudApplication architecture for cloud
Application architecture for cloud
 
Enterasys OneFabric Brochure
Enterasys OneFabric BrochureEnterasys OneFabric Brochure
Enterasys OneFabric Brochure
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
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
 
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 future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Understanding the Role of Media Types in RESTful applications

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. Upper four rather well understood by now. Mostly, people get the caching right, apply statelessness to invoke scalability.\n\nEvolvability is often ignored when REST is applied - although it is one of the key benefits of REST.\n
  90. Evolvability however seems to be ignored most of the times REST is applied.\n\nWhy is it so important?\n\nChange is inevitable to support new requirements. But it is difficult and costly to change a service when we have to coordinate that change with client owners. Especially if there are many clients that are difficult to reach.\n
  91. No coordination with clients necessary - Amazon never calls\n\nNo running application (e.g. an ongoing online purchase) has to be aborted\n\nHow can we reach that goal?\n\nLook at how communication between components works...\n
  92. Communication requires contract.\n\nTraditionally contract is owned by server.\n\nWhen server evolves it changes the contract.\n\nCoordination with clients necessary to apply changed contract.\n\nThe more clients there are and the more difficult it is to reach them the more difficult and costly is such a contract change.\n\n\n
  93. REST moves contract to global space.\n\nServer does not own contract anymore.\n\nServer cannot change the contract.\n\nServer change needs to take place within the bounds of the contract.\n\n\nThis is where media types come in: REST introduces media types to serve as the global contract of communication.\n\nIn order to understand how REST achieves the evolvability goal we need to look at the question:\n\nHow do media types provide a contract that is flexible enough to allow the server to change but still contract enough to allow communication.\n\nThe rest of the talk is looking into three questions around media types:\n\n
  94. \n
  95. \n
  96. \n
  97. Use HTML as an example\n
  98. Use HTML as an example\n
  99. Use HTML as an example\n
  100. Use HTML as an example\n
  101. Use HTML as an example\n
  102. The media type must enable the execution of a canonical use case.\n\nTransfer data and control.\n\n
  103. Explain use case.\n
  104. Use written use cases to drive media type design.\n
  105. Extract data and hypermedia controls from use case text scenario text.\n
  106. Elements derived from written use case.\n\n
  107. \n
  108. \n
  109. We define our media type application/procurement as follows.\n\nWe have now designed an example media type\n
  110. Recall the problem - server does not own contract so change has to happen within that contract.\n\nlook at how it serves the problem of communication bewtween c und s\n\nsince we do not communicate, media type as the contract must tell everything. and enable the evolution of the server.\n\nSo, let&amp;#x2019;s implement the shop server...\n
  111. Silly catalog returning resource - but is that wrong?\n
  112. \n
  113. Better - but on what basis did we do that?\n
  114. Media type provides a set of available data and control elements and combination rules.\n\nServer developers implement the service for a certain purpose. Pick from the media type what suits that purpose.\n\nAka common sense...\n
  115. the question really is: why do we programm this this way? What is driving us since the media type does not really tell us.\n
  116. Why did we implement the crawler in this way?\n\nMedia type provides idea of &amp;#x2018;set&amp;#x2019; of possible applications.\n\n\n
  117. Media type provides a set of available data and control elements and combination rules.\n\nMedia type provides an understanding of the canonical behavior of the service. Apply that to your intended application.\n\nHow can I realize my intended application using the media type.\n\nThere might be other media types for which I also do this.\n\nIf you give me media type X I can solve my application if all my What-Ifs hold true.\n
  118. Timing assumptions, for example are uniform.\n
  119. Add in-stock quantity to items.\n\nFor example to build an HTML page for a shop from catalog data.\n
  120. Not a problem from the point of view of the media type\n
  121. \n
  122. \n
  123. If they turn out to be useful to others, add extensions to the media type to share them with others. This is how the media type evolves over time.\n
  124. Suppose we have to return from some shop a catalog without an order processor.\n\n
  125. \n
  126. This will fail because the existence of the hypermedia control is blindly assumed. Yet it can&amp;#x2019;t.\n\n\n
  127. \n
  128. Error handling\n
  129. Don&amp;#x2019;t assume that something will happen that you cannot control.\n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. A contract that is flexible enough to allow the server to change yet contract enough to allow enable communication.\n
  141. Client and server developers use media types to learn what to expect and what to possibly provide.\n\nClient developers need to match their intended application to the data and control elements provided.\n\nServer developers need to match their intended exposed capabilities to the data and controls provided.\n
  142. \n