Slide 1

Slide 1 text

Understanding Ember.js Luke Melia, Yapp & Yapp Labs SXSW, March 13th, 2015 1

Slide 2

Slide 2 text

About this Nerd 2

Slide 3

Slide 3 text

Product + Ember Consulting 3 TODO: Half page Yapp,
 half page Yapp Labs Ember.js Consulting & Training

Slide 4

Slide 4 text

My experience with Ember Very early adopter Contributor to Ember.js codebase and ecosystem Develop and maintain commercial Ember.js apps Consultant to a few dozen Ember- using companies, both startups and enterprises. Give talks on Ember, including last week at EmberConf 2015 4

Slide 5

Slide 5 text

Organizer of Ember.js NYC Live streamed monthly at
 http://live.ember.nyc 5

Slide 6

Slide 6 text

What to expect
 from this session Starting high-level, moving to low- level. Pace and emphasis depends on who is in the room. Plus Q & A 6

Slide 7

Slide 7 text

How we deliver software has evolved… 7

Slide 8

Slide 8 text

How we deliver software has evolved… 8

Slide 9

Slide 9 text

How we deliver software has evolved… 9

Slide 10

Slide 10 text

How we deliver software has evolved… 10

Slide 11

Slide 11 text

How we deliver software has evolved… 11

Slide 12

Slide 12 text

How we deliver software has evolved… 12

Slide 13

Slide 13 text

…then came our beloved Internet… 13

Slide 14

Slide 14 text

…and the browser, which became the most ubiquitous app runtime in the world. 14

Slide 15

Slide 15 text

How we deliver via the web has evolved… 15 Static HTML sent from server to browser

Slide 16

Slide 16 text

How we deliver via the web has evolved… 16 Dynamic HTML sent from server to browser

Slide 17

Slide 17 text

How we deliver via the web has evolved… 17 Apps running on the server,
 sending HTML representations to browser

Slide 18

Slide 18 text

How we deliver via the web has evolved… 18 Server sends JS to the the browser,
 where the app is run, and interacts with a an API on the server

Slide 19

Slide 19 text

“The future is already here — it’s just not very evenly distributed” - William Gibson Many in tech haven’t yet arrived at the browser app paradigm. But for those of us who have, building apps the “old” way already feels antiquated. 19

Slide 20

Slide 20 text

If it quacks like a duck… Single Page Apps Rich Client Apps Browser Apps All synonymous 20

Slide 21

Slide 21 text

Let’s look at some Ember apps (Quick demos of Beatport, Vine, Twitch, Bustle, & Zendesk) 21

Slide 22

Slide 22 text

Similar to Native Mobile Apps Native apps have a similar paradigm of client app code talking to an API Differences in “install” and “update” processes. Walled gardens vs. open web. 22

Slide 23

Slide 23 text

We have been moving in this direction with Javascript in web tech for a while. In many of our early attempts, our Javascript code collapsed under its own weight. 23

Slide 24

Slide 24 text

The Need We desperately needed collective wisdom and best practices that we didn’t yet have. 24

Slide 25

Slide 25 text

The Need We needed it in the form of code that could help us structure and build these experiences in an approachable and maintainable way. 25

Slide 26

Slide 26 text

The Need There were lots of developers around the world solving the same problems at the same time. 26

Slide 27

Slide 27 text

The Need And as has become custom, we tried to share what we learned with each other in the form of code, open source code. 27

Slide 28

Slide 28 text

The Need There were no obstacles to doing this on the open web, no gatekeepers to check progress. 28

Slide 29

Slide 29 text

Lots of innovation in this space:
 a mind-boggling number of frameworks. 29

Slide 30

Slide 30 text

30 by The big three (today)

Slide 31

Slide 31 text

Goliath tech companies slug it out
 in market after market. 31 by

Slide 32

Slide 32 text

But this space is different. 32

Slide 33

Slide 33 text

Ember is the opposite, it is decentralized. 33 14 core team members from 11 different companies, large and small Competitive spirit, but no corporate agenda All work happens in the open

Slide 34

Slide 34 text

Driven by a belief that our apps are not unique snowflakes. 34

Slide 35

Slide 35 text

Driven by the belief that we can build great apps faster by aggressively commoditizing solutions to our shared problems. 35

Slide 36

Slide 36 text

Driven by a wish to “end the bikeshedding…” 36

Slide 37

Slide 37 text

Ember is driven by a belief that building web apps can be a joy, and that we should not settle for less. 37

Slide 38

Slide 38 text

Who is using Ember? 38 Many more… See also: http://builtwithember.io

Slide 39

Slide 39 text

39 How does a framework support you as the size and complexity of your app increases? How does a framework support you as the size and complexity of your app increases? How
 does a framework
 support you as the size and
 complexity of your app increases?

Slide 40

Slide 40 text

Ember’s approach shines as the size and complexity of an app grows. 40 Let’s look at why.

Slide 41

Slide 41 text

It should be clear where code belongs and where to find it. 41

Slide 42

Slide 42 text

You should have to write and maintain the least amount of code necessary. 42

Slide 43

Slide 43 text

Change in one area of your app should not affect other areas. 43

Slide 44

Slide 44 text

Clear Delineation of Responsibilities 44 Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes

Slide 45

Slide 45 text

Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes Router 45 The Router transitions between a collection of routes, each representing a high-level application state.

Slide 46

Slide 46 text

Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes 46 Routes Each Route selects an appropriate model for its state, and handles high-level events appropriately.

Slide 47

Slide 47 text

Router Controller Component Controller Component Component Component C C C C C C C C C C C C Template Template Routes Models 47 Model Model Model Model Models encapsulate the data and
 relationships in your problem domain.

Slide 48

Slide 48 text

Router Component Model Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes Models 48 Controllers present data to a template for rendering, by providing access to models and by managing local transient state. Controller Controller

Slide 49

Slide 49 text

Templates 49 Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes Templates define the HTML to render via databinding and components.

Slide 50

Slide 50 text

Components 50 Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes Components render a UI consisting of data-bound HTML and event handlers. They are composable.

Slide 51

Slide 51 text

Inside Components 51 Component

Slide 52

Slide 52 text

Inside Ember Components 52 Javascript Template The Template is declarative way to describe
 the HTML to be output, including bound data.
 The Javascript portion lets you handle DOM events, lifecycle management, and more.

Slide 53

Slide 53 text

Ember’s Nested Routes and URLs 53

Slide 54

Slide 54 text

github.com/emberjs/ember.js 54

Slide 55

Slide 55 text

github.com/emberjs/ember.js/issues 55

Slide 56

Slide 56 text

github.com/emberjs/ember.js/issues?q=closed 56

Slide 57

Slide 57 text

github.com/emberjs/ember.js 57

Slide 58

Slide 58 text

github.com/emberjs/ember.js/issues 58

Slide 59

Slide 59 text

github.com/emberjs/ember.js/issues?q=closed 59

Slide 60

Slide 60 text

github.com/emberjs/ember.js 60 {{outlet}}

Slide 61

Slide 61 text

github.com/emberjs/ember.js/issues 61 {{outlet}}

Slide 62

Slide 62 text

github.com/emberjs/ember.js/issues?q=closed 62

Slide 63

Slide 63 text

63 A map helps you know where you are and where to find things.

Slide 64

Slide 64 text

The router DSL is a map of your app 64 PostRoute will load the Post model into the PostController and render the ‘post’ template
 into the main outlet.

Slide 65

Slide 65 text

The router DSL is a map of your app 65 CommentsRoute will set up the CommentsController and render the ‘comments’ template into the main outlet of the ‘post’ template.

Slide 66

Slide 66 text

Pods of Functionality Ember apps are organized by hanging Controller- Template pairs off of each Route, providing clear boundaries and isolation. 66

Slide 67

Slide 67 text

Go with the Flow Ember apps have a clear flow of data and events. 67

Slide 68

Slide 68 text

Router Controller Component Model Controller Component Component Component C C C C C C C C C C C C Model Model Model Template Template Routes A clear information flow: data down, actions up 68 Data flows down from models via bindings Actions flow up from view layer to the router Router updates models & controllers based on events

Slide 69

Slide 69 text

Clean, declarative templates Ember uses Handlebars,
 a superset of the Mustache templating language.
 
 Emphasis on keeping templates “clean.” 69

Slide 70

Slide 70 text

Clean, declarative templates 70 Yep. Nope. Not even possible.

Slide 71

Slide 71 text

Data-bound Templates 71 All data-bound! Property paths in Ember Handlebars expressions are automatically observed and updated upon change.

Slide 72

Slide 72 text

Emphasis on declarative interfaces (supports backward-compatible performance improvements) 72 metal-views htmlbars

Slide 73

Slide 73 text

Ember’s Object Model, Observables, and Computed Properties 73

Slide 74

Slide 74 text

Ember’s Object Model, Observables, CPs 74

Slide 75

Slide 75 text

Ember’s Object Model, Observables, CPs 75

Slide 76

Slide 76 text

Ember’s Object Model, Observables, CPs 76

Slide 77

Slide 77 text

Ember’s Object Model, Observables, CPs 77

Slide 78

Slide 78 text

Ember’s Object Model, Observables, CPs 78

Slide 79

Slide 79 text

Ember’s Object Model, Observables, CPs 79

Slide 80

Slide 80 text

Ember’s Object Model, Observables, CPs 80

Slide 81

Slide 81 text

Ember’s Object Model, Observables, and Computed Properties 81 Wins: write more declarative code Leverage decades of OO code reuse experience Consistent APIs throughout Ember

Slide 82

Slide 82 text

Ember Data 82 make it easier to read and write to JSON REST APIs supports working with relationships between models 1.0 scheduled for June 12th

Slide 83

Slide 83 text

Embracing Web Standards, and Pushing the Web Forward The Ember community is a leading force in vetting and influencing emerging web standards. This includes Promises, ES6 Modules, and soon, annotations. Core team member Yehuda Katz served on the TC-39 standards body and maintains close relationships there. ember-cli apps ship with ember-cli-babel, which transpiles ES6 features to ES5-safe code. 83

Slide 84

Slide 84 text

Testing 84 Excellent tooling for acceptance tests Decent support for unit tests Mature adapters for QUnit (default) and Mocha

Slide 85

Slide 85 text

Testing Code Example 85

Slide 86

Slide 86 text

Liquid Fire 86 Animation library for Ember Very clean separation of concerns Demo! (An abbreviated version of this)

Slide 87

Slide 87 text

Liquid Fire 87

Slide 88

Slide 88 text

ember-cli: Amazing development experience 88 Generators &
 project scaffolding ES6 Module-based workflow Broccoli-based build
 with fast incremental builds Production packaging LiveReload

Slide 89

Slide 89 text

ember-cli: Amazing development experience 89 Development server with express.js, fast rebuilds, mocks & proxy capabilities Robust addon API

Slide 90

Slide 90 text

Addon Ecosystem 90 725 addons and counting!

Slide 91

Slide 91 text

6-week release cycle, semantic versioning 91

Slide 92

Slide 92 text

Ember
 Inspector 92

Slide 93

Slide 93 text

Open Source License: MIT License 93 Very open, commercial-friendly OSS license “Do whatever you like with it”

Slide 94

Slide 94 text

Downsides: Summary SEO Time to initial render Rerender performance 94

Slide 95

Slide 95 text

Downsides: Solution on the Horizon Fastboot! Renders initial HTML on a Node.js server by running Ember app in Node-land Precedence in other frameworks Currently under development 95

Slide 96

Slide 96 text

Downsides: Solution on the Horizon Glimmer! Diffs dynamic nodes for very fast, update- only-what-is-necessary re-renders In development 96

Slide 97

Slide 97 text

97 Follow me @lukemelia Some examples appear courtesy of my company, Yapp Labs.
 We are available for Ember.js-related consulting. Contact luke@yapp.us. Q & A

Slide 98

Slide 98 text

Creative Commons photo credits: https://www.flickr.com/photos/appraisaliq/5641906164, https://www.flickr.com/photos/pfsullivan_1056/6009151814, https://www.flickr.com/ photos/avaragado/6960433672, https://www.flickr.com/photos/clunkyrobot/82060751, https://www.flickr.com/photos/dhaun/14064199636, https://www.flickr.com/photos/ dehub/2570417338, https://www.flickr.com/photos/joestump/5193676861, https://www.flickr.com/photos/splorp/8544662113, https://www.flickr.com/photos/reutc/2459061463, https://www.flickr.com/photos/cristiano_betta/2909483129, https://www.flickr.com/photos/jasonunbound/240727795, https://www.flickr.com/photos/ armydre2008/5899177632, https://www.flickr.com/photos/chaoticmind75/5529114126, https://www.flickr.com/photos/15609463@N03/15004281025, https://www.flickr.com/ photos/simonsmithster/3418650838, https://www.flickr.com/photos/thomashawk/9974469983, https://www.flickr.com/photos/bestarns/8305879000, https://www.flickr.com/ photos/kinerific/7561104998, https://www.flickr.com/photos/fakeisthenewreal/121258082, https://www.flickr.com/photos/9061377@N05/703903629, https://www.flickr.com/ photos/niznoz/4170565734 98 Thank you! @lukemelia @yapplabs @embernyc