pilot tech talk #9 — ember.js: productivity without the fatigue by jacek galanciak

35
Ember.js: Productivity without the fatigue Jacek Galanciak

Upload: pilot

Post on 10-Jan-2017

48 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Ember.js: Productivity without the fatigue

Jacek Galanciak

Page 2: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 3: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 4: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

This tech talk

• Not a tutorial

• Overview of Ember.js framework

• Overview of the ecosystem and processes

Page 5: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Ember.js encapsulates:

• Framework (“full-frontal framework”)

• Tooling

• Conventions

Page 6: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Installing Ember.js

$ npm install -g ember-cli

Page 7: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Creating a new project

Page 8: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 9: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Creating a new project

$ ember new people-app

Page 10: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 11: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

!"" README.md!"" app#   !"" app.js#   !"" components#   !"" controllers#   !"" helpers#   !"" index.html#   !"" models#   !"" resolver.js#   !"" router.js#   !"" routes#   !"" styles#   #   %"" app.css#   %"" templates#   %"" components!"" bower.json!"" config#   %"" environment.js!"" ember-cli-build.js!"" package.json!"" public#   !"" crossdomain.xml#   %"" robots.txt!"" testem.js!"" tests#   !"" helpers#   #   !"" destroy-app.js#   #   !"" module-for-acceptance.js#   #   !"" resolver.js#   #   %"" start-app.js#   !"" index.html#   !"" integration#   !"" test-helper.js#   %"" unit%"" vendor

16 directories, 19 files

Page 12: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Sass? Bootstrap?

$ ember install ember-cli-sass$ ember install ember-cli-bootstrap-sassy

Page 13: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Hello world$ ember g template applicationinstalling template create app/templates/application.hbs

<div> <label>Name:</label> {{input type="text" value=name placeholder="Enter your name"}} </div> <div class="text"> <h3>My name is {{name}} and I really like Ember!</h3> </div>

Page 14: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Hello world

$ ember serve

Just getting started with Ember? Please visit http://localhost:4200/ember-getting-started to get going

Livereload server on http://localhost:49152Serving on http://localhost:4200/

Page 15: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 16: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 17: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Ember CLI• generates projects and files

• upgrades your project

• installs addons

• builds your app

• much more

Page 18: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Building your app

$ ember build$ ember build --environment=production

Handled by Broccoli.js: a fully-featured asset pipeline, “React for your filesystem”

Page 19: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

<form {{action "createPost" on="submit"}}> <input type="submit"> </form>

<button {{action "buttonClicked"}}>Button</button>

import Ember from 'ember';

export default Ember.Route.extend({ actions: { buttonClicked(n) { alert('Oh yeah!'); }, createPost() { alert("Done!"); } } });

Page 20: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 21: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 22: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 23: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 24: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

App.Router.map(function() { this.route('mailbox', { path: '/:mailbox_id' }, function() { this.route('mail', { path: '/:message_id', resetNamespace: true }); }); });

<table> <tr> <th>Date</th> <th>Subject</th> <th>From</th> <th>To</th> </tr>

{{#each model.messages as |message|}} {{#link-to "mail" message tagName="tr"}} <td>{{date message.date}}</td> <td>{{message.subject}}</td> <td>{{message.from}}</td> <td>{{message.to}}</td> {{/link-to}} {{/each}} </table>

{{outlet}}

Visit emberjs.com for full example

Page 25: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Ember Data• Data persistence library for Ember

• Mechanism-agnostic (works with JSON APIs, websockets, IndexedDB)

• Follows jsonapi.org by default

• Customizable via adapters (eg. ActiveModelSerializer)

// app/models/post.js export default DS.Model.extend({ title: DS.attr("string"), body: DS.attr("string"),

comments: DS.hasMany("comment") });

store.find("post", 1); // find by ID store.createRecord("post", { title: "So easy", });

Page 26: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Animations$ ember install liquid-fire

export default function(){ this.transition( this.fromRoute('index'), this.toRoute('posts'), this.use('toLeft'), this.reverse('toRight') ); this.transition( this.fromRoute('posts.index'), this.toRoute('posts.new'), this.use('crossFade'), this.reverse('crossFade') ); };

Page 27: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Server-side rendering story• ember-fastboot.com

• Fast, reliable, no more fragile PhantomJS setups

• Good for SEO

• Good for slow mobile devices

• Under the hood: Node.JS app running your Ember app on the server

• Usually no change in code is required

Page 28: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 29: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 30: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Ember Inspector

http://brewhouse.io/blog/2015/05/13/emberjs-an-antidote-to-your-hype-fatigue.html

Page 31: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak
Page 32: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Release cycle, upgrades• A guaranteed minor version release every 6 weeks

(like Chrome, Rust)

• Every fourth release is an LTS release

• Easy to follow beta channel

• Easy upgrade path, helpful deprecation warnings, features are not removed before being deprecated for a few releases

Page 33: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Who uses Ember?

http://brewhouse.io/blog/2015/05/13/emberjs-an-antidote-to-your-hype-fatigue.html

Page 34: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

My subjective review

• Productivity: ⭐⭐⭐⭐⭐

• Joy: ⭐⭐⭐⭐

• Learning: ⭐⭐⭐

• Future: ⭐⭐⭐⭐⭐

(assuming you want to develop a rich single-page application)

Page 35: Pilot Tech Talk #9 — Ember.js: Productivity without the fatigue by Jacek Galanciak

Thank you!