Slide 1

Slide 1 text

Complex Component Design Ember.BP – 2015/02/11

Slide 2

Slide 2 text

Best of the month

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Song of the month

Slide 6

Slide 6 text

http://frontside.io/blog/2016/01/22/functional-templating-in- ember.html

Slide 7

Slide 7 text

https://github.com/samselikoff/ember-cli-mirage

Slide 8

Slide 8 text

Survey results

Slide 9

Slide 9 text

(Somewhat) Complex Component Design

Slide 10

Slide 10 text

Basic component concepts

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Non-block form (no hash)

Slide 13

Slide 13 text

Non-block form (no hash) Block form (with hash)

Slide 14

Slide 14 text

Non-block form (no hash) Block form (with hash) Yields parameters to the block form (function call)

Slide 15

Slide 15 text

Non-block form (no hash) Block form (with hash) Yields parameters to the block form (function call) Block params (function params)

Slide 16

Slide 16 text

Closure (vs. element) actions

Slide 17

Slide 17 text

Element actions (iact “string” actions)

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Closure actions

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Why closure actions? • They can return values • Enable reacting to actions sent from the controller • Better debuggability • They can also bubble (check out ember-route- action-helper)

Slide 24

Slide 24 text

Component design guidelines

Slide 25

Slide 25 text

Short & sweet non-block form

Slide 26

Slide 26 text

Don’t assume too much

Slide 27

Slide 27 text

Allow customization

Slide 28

Slide 28 text

Data down, actions up (Use actions)

Slide 29

Slide 29 text

Data down, actions up (Use actions) Don’t do that.

Slide 30

Slide 30 text

Advanced concepts • Keep your component layers decoupled • Find ways to prevent registering • Replace observers with (DOM) actions

Slide 31

Slide 31 text

Advanced concepts http://balinterdi.com/2015/09/10/complex-component-design- in-ember-intro.html

Slide 32

Slide 32 text

Thank you.