learning client hypermedia from the ground up
play

Learning Client Hypermedia from the Ground Up Mike Amundsen, API - PowerPoint PPT Presentation

Learning Client Hypermedia from the Ground Up Mike Amundsen, API Academy / CA @mamund Introduction Goals Understand Hypermedia for applications Refactor a plain/json app into Hypermedia app Learn how to add features w/o


  1. Learning Client Hypermedia from the Ground Up Mike Amundsen, API Academy / CA @mamund

  2. Introduction

  3. Goals ● Understand Hypermedia for applications ● Refactor a “plain/json” app into Hypermedia app ● Learn how to add features w/o versioning your app ● Identify the diff. between hypermedia Links and Templates ● Review two existing Hypermedia formats ● See how Hypermedia and Microservices work together Show that you can increase client adaptability w/o increasing the code complexity/size

  4. Hypermedia?

  5. Hypermedia?

  6. "When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions." - Roy Fielding, 2009

  7. "When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions." - Roy Fielding, 2009

  8. "When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions." - Roy Fielding, 2009

  9. Can you could just show me some examples?

  10. Hypermedia Examples

  11. Hypermedia Examples

  12. Hypermedia Examples

  13. Hypermedia Examples

  14. NOT Hypermedia Examples

  15. Hypermedia Examples

  16. Hypermedia Examples

  17. Hypermedia Examples

  18. H-Factors and Hypermedia Types http://amundsen.com/hypermedia/

  19. Hypermedia controls provide inline descriptions of your application's actions.

  20. Yeah, so why would you do that?

  21. "Hypermedia as the engine of application state."

  22. "Hypermedia as the engine of application state." HATEOAS

  23. "Hypermedia as the engine of application state." HATEOAS

  24. "Hypermedia as the engine of application state." Hypermedia Constraint

  25. Wait, Hypermedia Constraint ?

  26. In software architecture models, constraints are selected to promote system properties.

  27. As part of the Uniform Interface constraint, Fielding selected the Hypermedia to promote:

  28. As part of the Uniform Interface constraint, Fielding selected the Hypermedia to promote: Evolvability

  29. Evolvability "Evolvability represents the degree to which a component implementation can be changed without negatively impacting other components." Fielding, Section 2.3.4.1

  30. "Hypermedia as the engine of application state."

  31. "Use Hypermedia to execute application actions."

  32. Use Hypermedia

  33. Use Hypermedia

  34. Use Hypermedia to execute application actions.

  35. A Client w/o Hypermedia

  36. Disclaimer… “No frameworks or libraries where harmed in the making of these apps.” These example are NOT: • Production-Ready • Robust • Pretty

  37. TL;DNR… “I don’t have time right now, can I just download the code?” https://github.com/apiacademy/ndcoslo2015

  38. Client w/o Hypermedia ● Get JSON objects/collections from server ● Put Read/Write semantics in the client Code

  39. JSON objects/collections from server

  40. Put Read/Write Semantics in the Client Code

  41. Read/Write Semantics in the Client Code

  42. Live Demo of Client w/o Hypermedia

  43. Then you want to add some features...

  44. Let's add a new field ("completed") and some filters

  45. But the installed app IGNORES the new stuff!

  46. Oh, right. Now I need a new VERSION!

  47. NEW Read/Write Semantics in the Client Code

  48. OK, V2 code/test is done, RE-DEPLOY!

  49. Live Demo of VERSIONED Client w/o Hypermedia

  50. Well, that's not too bad in the browser.

  51. Well, that's not too bad in the browser. But those App Stores will be a pain!

  52. Client w/o Hypermedia (Review) ● Get JSON objects/collections from server ● Put Read/Write semantics in the client Code ● Changing URLs == new version ● Adding new URLs == new version ● Adding new features == new version

  53. Hey, what would Roy Do?

  54. Slide #22 from Roy Fielding's talk at Adobe's Evolve 2013

  55. Huh, OK. Show me.

  56. A Client with Hypermedia Links

  57. Client with Hypermedia Links ● Get the server to emit URLs ● Get the client to use the server's URLs

  58. Get the server to emit URLs

  59. Client now pulls the URLs from the message.

  60. Live Demo of Client with Hypermedia Links

  61. Hold on. I think you skipped something!

  62. Where did the "Add ToDo" come from?

  63. We're only sending empty links. We still need to code all the payload operations!

  64. Then you want to add some features… How about "Remove ToDo"?

  65. But the installed app IGNORES the new stuff!

  66. Oh, right. Now I need a new VERSION!

  67. Changes in payload operations are NOT FREE

  68. Client with Hypermedia Links (Review) ● Get the server to emit URLs ● Get the client to use the server's URLs ● Changing URLs is "free" ● Adding new URLs is "free" ● Adding new payload operations === new version

  69. SIDEBAR: HAL Media Type

  70. HAL Media Type ● Designed by Mike Kelly, 2011 ● Makes sending LINKS easy, standardized ● Lots of library support ● Used by Amazon and others

  71. ToDo App using HAL

  72. OK, how can I get all new features for "free"?

  73. A Client with Hypermedia Templates

  74. Client with Hypermedia Templates ● Get the server to emit Templates ● Get the client to use the server's Templates

  75. Get Server to emit templates.

  76. Client pulls all payload operation details from the message

  77. Live Demo of Client with Hypermedia Templates

  78. Then you want to add some features… How about "Search ToDo"?

  79. Get Server to emit the new Search template.

  80. Bask in the awesomeness of hypermedia.

  81. No Versions.

  82. No Versions. No Re-deploy.

  83. No Versions. No Re-deploy. Just Hypermedia!

  84. No Versions. No Re-deploy. Just Hypermedia!

  85. Client with Hypermedia Templates (Review) ● Get the server to emit Templates ● Get the client to use the server's Templates ● Changing Templates are "free" ● Adding new Templates is "free" ● Adding new payload operations is "free"

  86. SIDEBAR: Collection+JSON

  87. Collection+JSON Media Type ● Designed by Mike Amundsen, 2011 ● Makes sending TEMPLATES easy, standardized ● Decent library support ● Used by NPR and others

  88. ToDo App using Collection+JSON

  89. Microservice Bonus Slides

  90. Microservices and Hypermedia ● Relocating Components ● Refactoring Features ● Re-Deploying Clients

  91. Hypermedia with Links Supports Dynamic Relocating

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend