Slide 1

Slide 1 text

Breaking large JavaScript into small pieces Decoupling your JavaScript

Slide 2

Slide 2 text

Chico UI

Slide 3

Slide 3 text

Carousel

Slide 4

Slide 4 text

Modal

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Chico UI

Slide 7

Slide 7 text

Why

Slide 8

Slide 8 text

Why •Wrong inheritance pattern

Slide 9

Slide 9 text

Why •Wrong inheritance pattern •Non-extensible

Slide 10

Slide 10 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable

Slide 11

Slide 11 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable •Miscommunication between widgets

Slide 12

Slide 12 text

v1.0

Slide 13

Slide 13 text

Modules

Slide 14

Slide 14 text

Modules •Scalable

Slide 15

Slide 15 text

Modules •Scalable •Maintainable

Slide 16

Slide 16 text

Modules •Scalable •Maintainable •Reusable

Slide 17

Slide 17 text

Best Practices

Slide 18

Slide 18 text

JavaScript doesn’t provide modules

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

ECMAScript 6 2015 ~

Slide 21

Slide 21 text

The Recipe

Slide 22

Slide 22 text

Identify

Slide 23

Slide 23 text

Define

Slide 24

Slide 24 text

Viewport Desktop JS Shared JS Mobile JS

Slide 25

Slide 25 text

Code!

Slide 26

Slide 26 text

Viewport Desktop JS Shared JS Mobile JS

Slide 27

Slide 27 text

shared/Viewport.js

Slide 28

Slide 28 text

shared/Viewport.js prototype

Slide 29

Slide 29 text

shared/Viewport.js

Slide 30

Slide 30 text

Viewport Desktop JS Shared JS Mobile JS

Slide 31

Slide 31 text

desktop/Viewport.js

Slide 32

Slide 32 text

Viewport Desktop JS Shared JS Mobile JS

Slide 33

Slide 33 text

mobile/Viewport.js

Slide 34

Slide 34 text

Viewport Module

Slide 35

Slide 35 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable •Miscommunication between widgets

Slide 36

Slide 36 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable •Miscommunication between widgets

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Communication

Slide 39

Slide 39 text

Callbacks

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

Events

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Fight!

Slide 47

Slide 47 text

Fight!

Slide 48

Slide 48 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable •Miscommunication between widgets

Slide 49

Slide 49 text

Why •Wrong inheritance pattern •Non-extensible •Non-scalable •Miscommunication between widgets

Slide 50

Slide 50 text

Building

Slide 51

Slide 51 text

Modules

Slide 52

Slide 52 text

Package

Slide 53

Slide 53 text

Takeaway •Chico v1.0 •Modules •Extend with prototype •Reuse: Mobile + Desktop •Communicate via events

Slide 54

Slide 54 text

Fin