progressive web components
play

Progressive Web Components GOTO Berlin 2016 Frederik Dohr, @fnd - PowerPoint PPT Presentation

Progressive Web Components GOTO Berlin 2016 Frederik Dohr, @fnd Stefan Tilkov, @stilkov History repeating Web CORBA WS-* REST Whats the client side analogy? Web app 2) Web service 1) > Uses browser as runtime >


  1. Progressive Web Components GOTO Berlin 2016 Frederik Dohr, @fnd 
 Stefan Tilkov, @stilkov

  2. History repeating … Web CORBA WS-* REST

  3. What’s the client side analogy?

  4. “Web app” 2) “Web service” 1) > Uses browser as runtime > Use HTTP as transport > Ignores forward, back, refresh > Ignore verbs > Does not support linking > Ignores URIs > Exposes monolithic “app” > Expose single “endpoint” > Fails to embrace the browser > Fails to embrace the Web 1) in the SOAP/WSDL sense 2) built as a careless SPA

  5. Desktop-style single-page apps: The browser’s WS-*

  6. Assumption: JS-centric web apps can 
 be as good as native apps They shouldn’t be as bad!

  7. Simple two-step secret to improving the performance of any website, according to Maciej Ceglowski (@baconmeteor): “1. Make sure that the most important 
 elements of the page download and 
 render fj rst. 2. Stop there.” http://idlewords.com/talks/website_obesity.htm

  8. JavaScript framework tax bloat complexity technical debt dependency

  9. The web-native way of distributing logic > Rendering, layout, styling 
 Client Presentation on an unknown client > Logic & state machine on server Process Flow Server > Client user-agent extensible via 
 Domain Logic code on demand Data

  10. ROCA: Resource-oriented Client Architecture http:/ /roca-style.org

  11. Framework? We don’t need no stinking framework Maybe we do

  12. Framework bene fj ts folklore architecture opinion skills community components component model

  13. 🙐

  14. SPAs : web development :: Trump : democracy

  15. Any su ffj ciently complicated JavaScript client application contains an ad-hoc, informally-speci fj ed, bug-ridden, slow implementation of half a browser. — Stefan Tilkov, with apologies to Phillip Greenspun

  16. Hard to put into words how utterly broken JS- fj rst web development is. So many parts of the system work against you when you take the reins. — Alex Russell (@slightlylate)

  17. shopping cart task list date picker media player Application Component Component Component Component JavaScript Framework Browser Platform

  18. 
 < > 


  19. 
 <video > 


  20. 
 <video src="bunny.mp4" controls> 


  21. play / pause <video src="bunny.mp4" controls> 
 <track kind="subtitles" …> 
 </video> .play() / .pause()

  22. source: Big Buck Bunny

  23. The browser is the framework #UseThePlatform

  24. Application Component Component Component Component JavaScript Framework Browser Platform

  25. Application 😲 😲 Component Component JavaScript Framework Browser Platform

  26. Application Component Component Component Component Component Browser Platform

  27. 
 <audio src="meow.mp4" controls> 
 Application Component Component Component Component Browser Platform

  28. Application Glue Code Component Component Component Component Browser Platform

  29. <input type="text" class="date"> $("input.date").datepicker();

  30. <div class="tabs"> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </div>

  31. <div class="tabs"> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </div>

  32. <div class="tabs"> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> 🎊 Unobtrusive JavaScript 🎊 <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </div>

  33. 👍 Progressive Enhancement 👎 Glue Code CSS CSS CSS CSS JS JS JS JS ✓ Component Component Component Component HTML HTML HTML HTML Browser Platform

  34. 👍 Progressive Enhancement 👎 Progressive enhancement is not about dealing with old Glue Code browsers, it's about dealing with new browsers. CSS CSS CSS CSS JS JS JS JS ✓ — Jeremy Keith (@adactio) Component Component Component Component HTML HTML HTML HTML Browser Platform

  35. <div class="tabs"> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </div>

  36. <tab-nav> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> </tab-nav> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol>

  37. <tab-nav> $(".tabs").tabs(); <ul> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> </tab-nav> <tab-contents> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </tab-contents>

  38. $(".tabs").tabs(); <ul is="tab-nav"> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> <tab-contents> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </tab-contents>

  39. <ul is="tab-nav"> <li> <a href="#about">About</a> … <li> <a href="#comments">Discussion</a> </ul> 📅 📅 Custom Elements <tab-contents> <p id="about">lorem ipsum dolor sit amet</p> … <ol id="comments"> … </ol> </tab-contents>

  40. customElements.define("task-list");

  41. class TaskList extends HTMLElement {} customElements.define("task-list", TaskList);

  42. class TaskList extends HTMLElement { constructor() { // element created or upgraded super(); … } connectedCallback() { // element inserted into the DOM … } disconnectedCallback() { // element removed from the DOM … } } customElements.define("task-list", TaskList);

  43. class TaskList extends HTMLElement { … attributeChangedCallback(attrName, oldVal, newVal) { … } static get observedAttributes() { return ["theme"]; } } customElements.define("task-list", TaskList);

  44. class TaskList extends HTMLElement { … connectedCallback() { let obs = new MutationObserver(this.onChange); obs.observe(this, { childList: true, subtree: true }); } … onChange() { … } } customElements.define("task-list", TaskList);

  45. class TaskList extends HTMLElement { … connectedCallback() { let shadowRoot = this.attachShadow({ mode: "open" }); shadowRoot.innerHTML = "<canvas></canvas>"; … } 📅 📅 Shadow DOM … } customElements.define("task-list", TaskList);

  46. Glue Code Component Component Component Component Browser Platform

  47. 📅 📅 Custom Elements Glue Code Component Component Component Component Boring Is Good Browser Platform

  48. Component Glue Code Component Component Component Browser Platform image source: Openclipart/atlantis

  49. Style Guides & Component Component Libraries Glue Code Component Component Component Browser Platform image source: Openclipart/atlantis

  50. Wrap-up

  51. Backend platform goals > As few assumptions as possible > No implementation dependencies > Small interface surface > Based on standards > Parallel development Backend Platform > Independent deployment > Autonomous operations

  52. What’s the frontend platform analogy? > As few assumptions as possible > No implementation dependencies Frontend Platform > Small interface surface > Based on standards > Parallel development Backend Platform > Independent deployment > Autonomous operations

  53. The browser as a platform > Independent applications > Loosely coupled Frontend Platform > Separately deployable > Based on standard platform > Updated on the fly Backend Platform > Any device

  54. Summary

  55. Embracing the browsers constraints provides bene fj ts

  56. JS Frameworks provide a proprietary architecture

Recommend


More recommend