Components - more than a shinny frenzy

A presentation at Midwest JS in August 2019 in by KENIGBOLO MEYA STEPHEN

Slide 1

Slide 1

COMPONENTS More than a shinny frenzy! @expensivestevie 1

Slide 2

Slide 2

Hello! Terve! I’m Kenigbolo Meya Stephen Front End Engineering Lead @bcaster Arch Conveyer/Community Manager @TheCodeAfrique You can find me on twitter at @expensivestevie @expensivestevie 2

Slide 3

Slide 3

WHAT WE’LL BE LOOKING AT ▰ What exactly are web components? ▰ Early days of web components ▰ HTML components ▰ XBL ▰ Similarities, Differences, Failures ▰ Modern web components @expensivestevie 3

Slide 4

Slide 4

  1. What exactly are web components The beauty lies in the eyes of the beholder @expensivestevie 4

Slide 5

Slide 5

According to WebComponents.Org Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. @expensivestevie 5

Slide 6

Slide 6

  1. Early days of web components Yeah, this idea is not so new 😂 @expensivestevie 6

Slide 7

Slide 7

“ The initial attempts to extend the default DOM API came from the big browser companies (not facebook 😉). Their desire (and failure) to provide developers features to enhance web possibilities has led to what we today call web components @expensivestevie 7

Slide 8

Slide 8

  1. HTML Components Despite all the stick they get, MIcrosoft started us on the path to web components 👏👏👏 @expensivestevie 8

Slide 9

Slide 9

HTML COMPONENTS ▰ 1998 Microsoft proposed HTML Components (IE 5.5 support). ▰ The Goal - Change behaviour of default tags. ▰ Could be written in JScript or VBScript. ▰ MicroSoft ActiveX Scripting Interfaces was required @expensivestevie 9

Slide 10

Slide 10

@expensivestevie 10

Slide 11

Slide 11

@expensivestevie 11

Slide 12

Slide 12

  1. XBL (XML Binding Language) Don’t we all just love Mozilla 💖💖💖💖 @expensivestevie 12

Slide 13

Slide 13

XML Binding Language (XBL) ▰ In 2001, XBL was created with XBL 2 following in 2007. ▰ The Goal - Extend default DOM tags with custom behaviour. ▰ Was an addition to Mozilla’s XUL ▰ Full support on all Mozilla products @expensivestevie 13

Slide 14

Slide 14

MOZILLA XBL Concept Extending the DOM with custom tags. This would have improved readability as well as sustainable reusability. In general the concept was good ✅ Results Despite the concept being good, the implementations weren’t as good as the idea. 📛 @expensivestevie 14

Slide 15

Slide 15

@expensivestevie 15

Slide 16

Slide 16

Similarities, Differences, Failures! The devil always lies in the details! Maybe not! @expensivestevie 16

Slide 17

Slide 17

Similarities ▰ Extending the Default DOM tags behaviour ▰ Improve reusability ▰ Better code composition ▰ Improving developer experience @expensivestevie 17

Slide 18

Slide 18

Differences ▰ Microsoft used HTML (htc) while Mozilla used XML(xbl) ▰ Microsoft used a paradigm of one component per file, Mozilla however went with multiple bindings. ▰ Microsoft required ActiveX(IE) whilst Mozilla required it to have GRE (All mozilla products by default) @expensivestevie 18

Slide 19

Slide 19

Failures! There are no Failures - Just experiences and your reactions to them @expensivestevie 19

Slide 20

Slide 20

20

Slide 21

Slide 21

▰ 2001 - XBL dropped in favour of XBL 2. W3C released candidate recommendation of XBL 2 ▰ 2011 - Microsoft discontinues HTC, subsequently deprecates it in IE 10 release ▰ 2012 - Mozilla XBL 2 abandoned. No browser implemented the specs anywhere @expensivestevie 21

Slide 22

Slide 22

22

Slide 23

Slide 23

  1. Modern Web Components Huge thanks to Google’s work on Angularjs @expensivestevie 23

Slide 24

Slide 24

AngularJS In order to allow developers create their own tags as well as help with a better semantic for web apps, Google brought us AngularJS @expensivestevie 24

Slide 25

Slide 25

AngularJS Timeline ▰ Born in 2009. ▰ Released on Github in 2010. ▰ Stable version 1.0 rolled out in 2013 As much as we wouldn’t like to say it, the truth remains that the implementation of “components” in most of our favorite frontend frameworks originated from this @expensivestevie 25

Slide 26

Slide 26

React - Facebook In order to allow reusability of widgets, Facebook released its own library called React. React was born in 2011 and was released on Github in 2013. While not the most popular in term of Github stars, it’s the most popular in terms of keyword search and actual usage/adoption @expensivestevie 26

Slide 27

Slide 27

“ React allows developers create reusable web components as well as handle data change without reloading the page. It currently is used more than any framework out there and has a huge community. @expensivestevie 27

Slide 28

Slide 28

Vue - OSS Community Vue is a progressive framework for building user interfaces. Currently the most starred on github (in comparison with react and angular). Vue JS comes across as a pick of all the good parts in both Angular and React. It is community maintained and spearheaded by its creator Evan You @expensivestevie 28

Slide 29

Slide 29

“ As the core team, we obviously like Vue a lot. There are some problems we think it solves better than anything else out there. If we didn’t believe that, we wouldn’t be working on it. https://vuejs.org/v2/guide/comparison.html @expensivestevie 29

Slide 30

Slide 30

Web Component API Specs - Main concepts ▰ Custom Elements ▰ Shadow DOM ▰ ES Modules ▰ HTML Template @expensivestevie 30

Slide 31

Slide 31

Custom Elements 31

Slide 32

Slide 32

32

Slide 33

Slide 33

@expensivestevie 33

Slide 34

Slide 34

Shadow DOM 34

Slide 35

Slide 35

35

Slide 36

Slide 36

36

Slide 37

Slide 37

ES Modules @expensivestevie 37

Slide 38

Slide 38

38

Slide 39

Slide 39

HTML Template 39

Slide 40

Slide 40

40

Slide 41

Slide 41

41

Slide 42

Slide 42

That’s all for today folks 42

Slide 43

Slide 43

Thank You! KeyToss! Any questions? You can find me at ▰ Twitter @expensivestevie ▰ Github @kenigbolo @expensivestevie 43