integrating ember.js into legacy applications

22
into WELCOME Integrating legacy applications Dienstag, 08. Oktober 13

Upload: levelbossmike

Post on 27-Jun-2015

1.967 views

Category:

Technology


2 download

DESCRIPTION

How to integrate Ember.js into legacy applications

TRANSCRIPT

Page 1: Integrating Ember.js into legacy applications

into

WELCOME

Integrating

legacy applications

Dienstag, 08. Oktober 13

Page 2: Integrating Ember.js into legacy applications

Hi! I am Michael!

@LevelbossMike

Runtastic Head of Web Frontend

Dienstag, 08. Oktober 13

Page 3: Integrating Ember.js into legacy applications

Progressive Enhancement

is

PROBLEM?!

Dienstag, 08. Oktober 13

Page 4: Integrating Ember.js into legacy applications

AGREEMENT

Dienstag, 08. Oktober 13

Page 5: Integrating Ember.js into legacy applications

AGREEMENT

Dienstag, 08. Oktober 13

Page 6: Integrating Ember.js into legacy applications

AGREEMENT

Dienstag, 08. Oktober 13

Page 7: Integrating Ember.js into legacy applications

AGREEMENT

Dienstag, 08. Oktober 13

Page 8: Integrating Ember.js into legacy applications

IT WORKS BUT..

Structure? Maintainability?Testability?Extensibility?

Dienstag, 08. Oktober 13

Page 9: Integrating Ember.js into legacy applications

IT WORKS BUT..

Structure? Maintainability?Testability?Extensibility?

-> inconsistent

Dienstag, 08. Oktober 13

Page 10: Integrating Ember.js into legacy applications

IT WORKS BUT..

Structure? Maintainability?Testability?Extensibility?

-> inconsistent

-> bad

Dienstag, 08. Oktober 13

Page 11: Integrating Ember.js into legacy applications

IT WORKS BUT..

Structure? Maintainability?Testability?Extensibility?

-> inconsistent

-> bad

-> no

Dienstag, 08. Oktober 13

Page 12: Integrating Ember.js into legacy applications

IT WORKS BUT..

Structure? Maintainability?Testability?Extensibility?

-> inconsistent

-> bad

-> no

-> hell no!

Dienstag, 08. Oktober 13

Page 13: Integrating Ember.js into legacy applications

Framework!

SOLUTION

Dienstag, 08. Oktober 13

Page 14: Integrating Ember.js into legacy applications

ALTERNATIVES

Do It

YourselfExisting

Framework(Backbone), Marionette, Knockout, Batman,

React, Flight, Angular, Ember...Twitter & Facebook

yeah, right

Dienstag, 08. Oktober 13

Page 15: Integrating Ember.js into legacy applications

Runtastic <3 <3 <3 Ember.js

Angular.js Ember.js✓ popular (#4 github.com)

✓ easy to learn

␡ convention over configuration

␡ url-support

␡ nested UIs

␡ minimizes DOM-updates

␡ data-store

✓ popular (#22 github.com)

␡ easy to learn

✓ convention over configuration

✓ url-support

✓ nested UIs

✓ minimizes DOM-updates

✓ data-store

Dienstag, 08. Oktober 13

Page 16: Integrating Ember.js into legacy applications

TRUTH

JS-Frontend development is not trivial. Anybody expecting to build a functional app

in 5 minutes is batshit insane and should gtfo and die in a fire.

”“

Dienstag, 08. Oktober 13

Page 17: Integrating Ember.js into legacy applications

FINALLY

Dienstag, 08. Oktober 13

Page 18: Integrating Ember.js into legacy applications

Structure? Maintainability?Testability?Extensibility?

-> yes

-> yes

-> yes

-> yes

CONVENTIONS

Dienstag, 08. Oktober 13

Page 19: Integrating Ember.js into legacy applications

INTEGRATION

1 App = Ember.Application.create({ 2 rootElement: '#ember-app' 3 });

Easy:Use the built in rootElement-property on Ember.Application

Protip:You can have multiple Ember apps on one page.-> Prevent Ember from changing URL by extending the default Router.

1 App.Router = Ember.Router.extend({2 location: 'none'3 });

http://emberjs.jsbin.com/iVUCIRo/1

Dienstag, 08. Oktober 13

Page 20: Integrating Ember.js into legacy applications

ADVANCED INTEGRATION

1 App = Ember.Application.create({ 2 rootElement: '#ember-app', 3 4 ready: function() { 5 if (Ember.$('#ember-app').data('mode') == 'search') { 6 this.set('searchMode', true); 7 } 8 } 9 });10 11 App.IndexRoute = Ember.Route.extend({12 redirect: function() {13 if (App.get('searchMode')) {14 this.transitionTo('searchResults');15 } else {16 this.transitionTo('profile');17 }18 }19 });

http://emberjs.jsbin.com/iVUCIRo/5

Dienstag, 08. Oktober 13

Page 21: Integrating Ember.js into legacy applications

COMPONENTS

Components can be shared across applications.Components can be used to wrap 3rd party libraries (e.g. d3)Components can be used outside of a big Ember application.

Protip:Write now, use now and later in a single page app.

-> Components can be nested! Composition FTW!

1 jsFrameworks = [2 'Backbone', 'Marionette', 'Knockout', 'Batman',3 'React', 'Flight', 'Angular', 'Ember'];4 5 RT.SearchFieldComponent.create({ arrayToSearch: jsFrameworks })6 .appendTo('#component');

http://emberjs.jsbin.com/ezApeGe/6

Dienstag, 08. Oktober 13

Page 22: Integrating Ember.js into legacy applications

QUESTIONS?

Dienstag, 08. Oktober 13