SlideShare une entreprise Scribd logo
1  sur  44
The road to EmberJs 2.0
Lucio Grenzi
ROME 18-19 MARCH 2016
The road to EmberJs 2.0
Who is this guy
Freelance
Front end web developer
Over 10 years of programming
experience
Open source addicted
Github.com/dogwolf
The road to EmberJs 2.0
“A framework for creating ambitous web application”
- Emberjs homepage -
Latest version: v 2.4
Date of birth: 2011
Origin: SproutCore fork
MIT License
Mantained by the Ember.Js Community
Depends on handlebar.js and jQuery
More than 15000 GitHub stars
The road to EmberJs 2.0
What is Ember.js?
 A Javascript framework
 Based on MVC pattern
 Client side
 Single Page App
 Declarative
 Two ways data binding*
The road to EmberJs 2.0
AngularJs vs EmberJs
AngularJS is a toolset for building the framework most
suited to your application development
- AngularJs homepage-
A framework for creating ambitous web application”
- Emberjs homepage -
The road to EmberJs 2.0
Philosophy on AngularJs
Web application development needs first class support for
data binding, dependency injection and testability
Use this primitives to build your own high level
abstractions specific to your particular application's needs
The road to EmberJs 2.0
Quality of a framework
1. It should be clear where code belongs and where to
find it
2. You should have to write and mantain the least code
amount of code necessary
3. Change in one area of your app should not affect
others areas
The road to EmberJs 2.0
EmberJs Philosophy
 Stability without stagnation
 Big bang releases
 App rewrites (every new release)
 Long-lived (custom) branches
The road to EmberJs 2.0
EmberJs release cycle
Six weeks release cycle
Add new features
Deprecates nasty parts of the code
Ember 2.0 only removes features that were deprecated as
of Ember 1.13
The road to EmberJs 2.0
What’s new in EmberJs 2.0
• Ember CLI
• Shift to Components
• Glimmer, the new rendering engine
• ES6 modules at the core
• One-way values by default
• Simplification of many Ember concepts:
– New attribute binding syntax
– HTML syntax (angle brackets) for Components
– More consistent scoping
– much more…
The road to EmberJs 2.0
Ember-cli
The road to EmberJs 2.0
Ember-cli support
Handlebars
HTMLBars
Emblem
LESS
Sass
Compass
Stylus
CoffeeScript
EmberScript
Minified JS & CSS
The road to EmberJs 2.0
Ember-cli (cont.)
Require Node.js and npm
Require Bower in order to keep your front-end dependencies
up-to-date
$npm install -g bower
Reccomended PhantomJs in order to use the automated test
runner
$npm install -g phantomjs-prebuilt
The road to EmberJs 2.0
Create a new project
$ember new my-app
Launch a project
$cd my-app
$ember server
Navigate to http://localhost:4200 to see the new app
The road to EmberJs 2.0
Other usefull commands
$ember build
Builds the application into the dist/ directory
$ember test
Run tests with Testem in CI mode.
$ember install <addon-name>
Installs addon-name into your project and saves it to the
package.json file
The road to EmberJs 2.0
Ember-cli addon system
Provides a way to create reusable units of code
Extend the build tool
Found all the addons at emberaddons.com
The road to EmberJs 2.0
Emberaddons
The road to EmberJs 2.0
Handlebars 2.x
A superset of the Mustache template engine
First added to EmberJ 1.9
The focus is keeping the logic out of the template
The road to EmberJs 2.0
<body>
<script type="text/x-handlebars" id="ember-template" data-template-
name="index">
</b>My videos</b><ul>
{{#each video in videos}}
<li>{{#link-to 'videos.edit' video}}{{video.title}}{{/link-to}}</li>
{{/each}}
</ul></script>
</body>
The road to EmberJs 2.0
var source = $("#ember-template").html();
var template = Handlebars.compile(source);
App.Router.map(function() {
this.resource("videos", function(){
this.route("edit", { path: "/:video_id" });
});
});
Result:
<ul>
<li><a href="/videos/1">My first video</a></li>
<li><a href="/videos/2">My second video</a></li>
<li><a href="/videos/3">My third video</a></li>
</ul>
The road to EmberJs 2.0
Glimmer
The render engine, since version 1.13
Takes advantage of the groundwork laid by HTMLBars to
dramatically improve re-rendering performance.
Compatible with the full public API of Ember 1.x
The road to EmberJs 2.0
Glimmer (cont.)
Takes advantage of the React-inspired improvements to
the Ember programming model

 Value-diffing strategy by using a virtual tree of the
dynamic areas of the DOM
 Supporting efficient re-renders of entire data structures.
 Explicit mutation (via set) when it is used

The road to EmberJs 2.0
One-Way Bindings
On Ember 1.x component properties used to be bound
two ways.
Property of a component as well as its data source are
both mutable.
{{#my-component compName=model.name }}{{/my-
component}}
<my-component compName=model.name ></my-
component>
The road to EmberJs 2.0
Explicitly a two-way binding
There is a new mut keyword to explicit the old behaviour
<my-component compName={{mut model.name}} ></my-
component>
The road to EmberJs 2.0
Manage a mutable component
Set the value of the property
this.attrs.compName.update("newcompName");
Show the actual value of the property
this.attrs.firstName.value;
The road to EmberJs 2.0
Ember-data
Library for robustly managing model data in your Ember.js
applications
Is designed to be agnostic to the underlying persistence
mechanism
Uses Promises/A+-compatible promises to manage
loading and saving records
The road to EmberJs 2.0
Getting started with Ember-data
Version >= 2.3 ember-data is a proper Ember-CLI
$ember install ember-data
Version < 2.3, add the npm package and add the
dependency via bower:
npm install ember-data@v2.2.2 --save-dev
bower install ember-data --save
The road to EmberJs 2.0
Ember-data flow
Application
Store
Adapter
Cloud
Promise (with records)
Promise (json)
find()
find()
XHR() XHR() returns
The road to EmberJs 2.0
The Store
The store is responsible for managing the lifecycle of your
models.
By loading the Ember Data library in your app, all of the
routes and controllers in will get a new store property
The road to EmberJs 2.0
The Adapter
The adapter is responsible for translating requests from
Ember-data into requests on your server.
The road to EmberJs 2.0
How it woks
// app/models/news.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
createdBy: DS.attr('string'),
createdAt: DS.attr('date'),
comments: DS.hasMany('comment')
});
// app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
message: DS.attr('string'),
sentAt: DS.attr('date'),
nickname: DS.attr('string'),
post: DS.belongsTo('news')
});
Retrieve multiple records
var newses = this.store.findAll('news'); // => GET /posts
var newses = this.store.peekAll('news'); // => no network request
Query for multiple records
this.store.query('news', { filter: { createdBy:'Lucio' }
}).then(function(param_1) {
});
The road to EmberJs 2.0
More intuitive attribute bindings
Ember 1.x (deprecated)
<a {{bind-attr href=url}}>Click here</a>
Ember 2.x
<a href="{{url}}">Click here</a>
The road to EmberJs 2.0
Components
Based on of the W3C Web Components specification
The specification is comprised of four smaller
specifications; templates, decorators, shadow DOM,
and custom elements.
The road to EmberJs 2.0
Ember Components vs. Ember Views
 EmberJs is a MVC .. V doesn't stand for view?

 Components are a subclass of Ember.View

 Views are generally found in the context of a controller.

 Views sit behind a template and turn input into a semantic
action in a controller or route.
The road to EmberJs 2.0
Ember Components vs. Ember Views
 EmberJs component do not have a context, they only
know about the interface that they define
 Components can be rendered into any context, making it
decoupled and reusable.
 In order to render properly a component you must supply
it with data that it's expecting
The road to EmberJs 2.0
Anatomy of an Ember Components
An Ember component consists of a Handlebars template
file and an accompanying Ember class (if needed extra
interactivity with the component).
The road to EmberJs 2.0
Generate an Ember Component
$ ember generate component multitabs
This will create three new files
 a Handlebars file for our HTML
 app/templates/components/multitabs.hbs
 a JavaScript file for our component class
app/components/multitabs.js
 a test file
tests/integration/components/multitabs-test.js
The road to EmberJs 2.0
Using the Component
Open the application template
app/templates/application.hbs
Add in the following after the h3 tag to use the component.
{{multitabs}}
The road to EmberJs 2.0
Add dynamic data
$ ember generate route application
This will generate app/routes/application.js.
Open this up and add a model property:
export default Ember.Route.extend({
model: function(){
});
});
The road to EmberJs 2.0
Add Polymer to Ember project
$ ember new PolymerProject
$ bower install polymer --save
The road to EmberJs 2.0
// Brocfile.js
...
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
...
var app = new EmberApp();
...
var polymer = pickFiles('bower_components/', {
srcDir: '',
files: [
'webcomponentsjs/webcomponents.js',
'polymer/polymer.html'
// 'polymer/polymer.js'
],
destDir: '/assets'
});
module.exports = mergeTrees([ polymer, app.toTree()]);
// Index.html
...
<script src="assets/webcomponentsjs/webcomponents.js"></script>
...
The road to EmberJs 2.0
Resources and References
https://github.com/emberjs/data
https://github.com/emberjs/rfcs/pull/15
http://ember-cli.com/
http://code.tutsplus.com/tutorials/ember-components-a-
deep-dive--net-35551
http://www.sitepoint.com/understanding-components-in-
ember-2/
The road to EmberJs 2.0
Questions?
https://www.flickr.com/photos/derek_b/3046770021/
Thanks!
ROME 18-19 MARCH 2016
l.grenzi@gmail.com
Dogwolf
lucio.grenzi
All pictures belong
to their respective authors

Contenu connexe

Tendances

Controlling The Cloud With Python
Controlling The Cloud With PythonControlling The Cloud With Python
Controlling The Cloud With Python
Luca Mearelli
 
Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3
Clinton Dreisbach
 

Tendances (20)

The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
 
CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013CoffeeScript - TechTalk 21/10/2013
CoffeeScript - TechTalk 21/10/2013
 
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and moreSymfony Guard Authentication: Fun with API Token, Social Login, JWT and more
Symfony Guard Authentication: Fun with API Token, Social Login, JWT and more
 
Controlling The Cloud With Python
Controlling The Cloud With PythonControlling The Cloud With Python
Controlling The Cloud With Python
 
To Batch Or Not To Batch
To Batch Or Not To BatchTo Batch Or Not To Batch
To Batch Or Not To Batch
 
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and TricksAnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
AngularJS - TechTalk 3/2/2014
AngularJS - TechTalk 3/2/2014AngularJS - TechTalk 3/2/2014
AngularJS - TechTalk 3/2/2014
 
Rails 3 Beautiful Code
Rails 3 Beautiful CodeRails 3 Beautiful Code
Rails 3 Beautiful Code
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.js
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Mobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast diveMobile Open Day: React Native: Crossplatform fast dive
Mobile Open Day: React Native: Crossplatform fast dive
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3
 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
 
Pi
PiPi
Pi
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
 

En vedette

The Automation and Proliferation of Military Drones and the Protection of Civ...
The Automation and Proliferation of Military Drones and the Protection of Civ...The Automation and Proliferation of Military Drones and the Protection of Civ...
The Automation and Proliferation of Military Drones and the Protection of Civ...
Angelo State University
 

En vedette (20)

Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Intro to Ember.js
Intro to Ember.jsIntro to Ember.js
Intro to Ember.js
 
Are Drones our best friends?
Are Drones our best friends?Are Drones our best friends?
Are Drones our best friends?
 
HTTPS and YOU
HTTPS and YOUHTTPS and YOU
HTTPS and YOU
 
The Automation and Proliferation of Military Drones and the Protection of Civ...
The Automation and Proliferation of Military Drones and the Protection of Civ...The Automation and Proliferation of Military Drones and the Protection of Civ...
The Automation and Proliferation of Military Drones and the Protection of Civ...
 
рисинка
рисинкарисинка
рисинка
 
Let's go HTTPS
Let's go HTTPSLet's go HTTPS
Let's go HTTPS
 
Commodore 64 Mon Amour
Commodore 64 Mon AmourCommodore 64 Mon Amour
Commodore 64 Mon Amour
 
Brief Introduction to Ember
Brief Introduction to EmberBrief Introduction to Ember
Brief Introduction to Ember
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
 
Single-Page Application Design Principles 101
Single-Page Application Design Principles 101Single-Page Application Design Principles 101
Single-Page Application Design Principles 101
 
Ember: Guts & Goals
Ember: Guts & GoalsEmber: Guts & Goals
Ember: Guts & Goals
 
Distributed Companies: A WordPress.com Team Perspective - Davide Casali - Cod...
Distributed Companies: A WordPress.com Team Perspective - Davide Casali - Cod...Distributed Companies: A WordPress.com Team Perspective - Davide Casali - Cod...
Distributed Companies: A WordPress.com Team Perspective - Davide Casali - Cod...
 
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
 
Demistifying the 3D Web
Demistifying the 3D WebDemistifying the 3D Web
Demistifying the 3D Web
 
Welcome to Mordor - Daniel Kahn - Codemotion Amsterdam 2016
Welcome to Mordor - Daniel Kahn - Codemotion Amsterdam 2016Welcome to Mordor - Daniel Kahn - Codemotion Amsterdam 2016
Welcome to Mordor - Daniel Kahn - Codemotion Amsterdam 2016
 
Microsoft &lt;3 Open Source: Un anno dopo!
Microsoft &lt;3 Open Source: Un anno dopo!Microsoft &lt;3 Open Source: Un anno dopo!
Microsoft &lt;3 Open Source: Un anno dopo!
 
Customize and control connected devices
Customize and control connected devicesCustomize and control connected devices
Customize and control connected devices
 
Death to Icon Fonts - Seren Davies - Codemotion Amsterdam 2016
Death to Icon Fonts - Seren Davies - Codemotion Amsterdam 2016Death to Icon Fonts - Seren Davies - Codemotion Amsterdam 2016
Death to Icon Fonts - Seren Davies - Codemotion Amsterdam 2016
 
The rise and fall and rise of Virtual Reality - Adriaan Rijkens - Codemotion...
The rise and fall and rise of Virtual Reality -  Adriaan Rijkens - Codemotion...The rise and fall and rise of Virtual Reality -  Adriaan Rijkens - Codemotion...
The rise and fall and rise of Virtual Reality - Adriaan Rijkens - Codemotion...
 

Similaire à The road to Ember.js 2.0

Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
CodeCamp Iasi 10 March 2012 -   Gabriel Enea - ASP.NET Web APICodeCamp Iasi 10 March 2012 -   Gabriel Enea - ASP.NET Web API
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Codecamp Romania
 

Similaire à The road to Ember.js 2.0 (20)

Intro to EmberJS
Intro to EmberJSIntro to EmberJS
Intro to EmberJS
 
Ember presentation
Ember presentationEmber presentation
Ember presentation
 
Delivering with ember.js
Delivering with ember.jsDelivering with ember.js
Delivering with ember.js
 
Workshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte IWorkshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte I
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
 
Ember CLI & Ember Tooling
Ember CLI & Ember ToolingEmber CLI & Ember Tooling
Ember CLI & Ember Tooling
 
Meteor
MeteorMeteor
Meteor
 
One does not simply "Upgrade to Rails 3"
One does not simply "Upgrade to Rails 3"One does not simply "Upgrade to Rails 3"
One does not simply "Upgrade to Rails 3"
 
NodeJS @ ACS
NodeJS @ ACSNodeJS @ ACS
NodeJS @ ACS
 
TorqueBox
TorqueBoxTorqueBox
TorqueBox
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
Spring tutorial
Spring tutorialSpring tutorial
Spring tutorial
 
Building Ambitious Web Apps with Ember
Building Ambitious Web Apps with EmberBuilding Ambitious Web Apps with Ember
Building Ambitious Web Apps with Ember
 
Create an application with ember
Create an application with ember Create an application with ember
Create an application with ember
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
 
RoR guide_p1
RoR guide_p1RoR guide_p1
RoR guide_p1
 
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
CodeCamp Iasi 10 March 2012 -   Gabriel Enea - ASP.NET Web APICodeCamp Iasi 10 March 2012 -   Gabriel Enea - ASP.NET Web API
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
 
Ember,js: Hipster Hamster Framework
Ember,js: Hipster Hamster FrameworkEmber,js: Hipster Hamster Framework
Ember,js: Hipster Hamster Framework
 

Plus de Codemotion

Plus de Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Dernier

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Dernier (20)

WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

The road to Ember.js 2.0

  • 1. The road to EmberJs 2.0 Lucio Grenzi ROME 18-19 MARCH 2016
  • 2. The road to EmberJs 2.0 Who is this guy Freelance Front end web developer Over 10 years of programming experience Open source addicted Github.com/dogwolf
  • 3. The road to EmberJs 2.0 “A framework for creating ambitous web application” - Emberjs homepage - Latest version: v 2.4 Date of birth: 2011 Origin: SproutCore fork MIT License Mantained by the Ember.Js Community Depends on handlebar.js and jQuery More than 15000 GitHub stars
  • 4. The road to EmberJs 2.0 What is Ember.js?  A Javascript framework  Based on MVC pattern  Client side  Single Page App  Declarative  Two ways data binding*
  • 5. The road to EmberJs 2.0 AngularJs vs EmberJs AngularJS is a toolset for building the framework most suited to your application development - AngularJs homepage- A framework for creating ambitous web application” - Emberjs homepage -
  • 6. The road to EmberJs 2.0 Philosophy on AngularJs Web application development needs first class support for data binding, dependency injection and testability Use this primitives to build your own high level abstractions specific to your particular application's needs
  • 7. The road to EmberJs 2.0 Quality of a framework 1. It should be clear where code belongs and where to find it 2. You should have to write and mantain the least code amount of code necessary 3. Change in one area of your app should not affect others areas
  • 8. The road to EmberJs 2.0 EmberJs Philosophy  Stability without stagnation  Big bang releases  App rewrites (every new release)  Long-lived (custom) branches
  • 9. The road to EmberJs 2.0 EmberJs release cycle Six weeks release cycle Add new features Deprecates nasty parts of the code Ember 2.0 only removes features that were deprecated as of Ember 1.13
  • 10. The road to EmberJs 2.0 What’s new in EmberJs 2.0 • Ember CLI • Shift to Components • Glimmer, the new rendering engine • ES6 modules at the core • One-way values by default • Simplification of many Ember concepts: – New attribute binding syntax – HTML syntax (angle brackets) for Components – More consistent scoping – much more…
  • 11. The road to EmberJs 2.0 Ember-cli
  • 12. The road to EmberJs 2.0 Ember-cli support Handlebars HTMLBars Emblem LESS Sass Compass Stylus CoffeeScript EmberScript Minified JS & CSS
  • 13. The road to EmberJs 2.0 Ember-cli (cont.) Require Node.js and npm Require Bower in order to keep your front-end dependencies up-to-date $npm install -g bower Reccomended PhantomJs in order to use the automated test runner $npm install -g phantomjs-prebuilt
  • 14. The road to EmberJs 2.0 Create a new project $ember new my-app Launch a project $cd my-app $ember server Navigate to http://localhost:4200 to see the new app
  • 15. The road to EmberJs 2.0 Other usefull commands $ember build Builds the application into the dist/ directory $ember test Run tests with Testem in CI mode. $ember install <addon-name> Installs addon-name into your project and saves it to the package.json file
  • 16. The road to EmberJs 2.0 Ember-cli addon system Provides a way to create reusable units of code Extend the build tool Found all the addons at emberaddons.com
  • 17. The road to EmberJs 2.0 Emberaddons
  • 18. The road to EmberJs 2.0 Handlebars 2.x A superset of the Mustache template engine First added to EmberJ 1.9 The focus is keeping the logic out of the template
  • 19. The road to EmberJs 2.0 <body> <script type="text/x-handlebars" id="ember-template" data-template- name="index"> </b>My videos</b><ul> {{#each video in videos}} <li>{{#link-to 'videos.edit' video}}{{video.title}}{{/link-to}}</li> {{/each}} </ul></script> </body>
  • 20. The road to EmberJs 2.0 var source = $("#ember-template").html(); var template = Handlebars.compile(source); App.Router.map(function() { this.resource("videos", function(){ this.route("edit", { path: "/:video_id" }); }); }); Result: <ul> <li><a href="/videos/1">My first video</a></li> <li><a href="/videos/2">My second video</a></li> <li><a href="/videos/3">My third video</a></li> </ul>
  • 21. The road to EmberJs 2.0 Glimmer The render engine, since version 1.13 Takes advantage of the groundwork laid by HTMLBars to dramatically improve re-rendering performance. Compatible with the full public API of Ember 1.x
  • 22. The road to EmberJs 2.0 Glimmer (cont.) Takes advantage of the React-inspired improvements to the Ember programming model   Value-diffing strategy by using a virtual tree of the dynamic areas of the DOM  Supporting efficient re-renders of entire data structures.  Explicit mutation (via set) when it is used 
  • 23. The road to EmberJs 2.0 One-Way Bindings On Ember 1.x component properties used to be bound two ways. Property of a component as well as its data source are both mutable. {{#my-component compName=model.name }}{{/my- component}} <my-component compName=model.name ></my- component>
  • 24. The road to EmberJs 2.0 Explicitly a two-way binding There is a new mut keyword to explicit the old behaviour <my-component compName={{mut model.name}} ></my- component>
  • 25. The road to EmberJs 2.0 Manage a mutable component Set the value of the property this.attrs.compName.update("newcompName"); Show the actual value of the property this.attrs.firstName.value;
  • 26. The road to EmberJs 2.0 Ember-data Library for robustly managing model data in your Ember.js applications Is designed to be agnostic to the underlying persistence mechanism Uses Promises/A+-compatible promises to manage loading and saving records
  • 27. The road to EmberJs 2.0 Getting started with Ember-data Version >= 2.3 ember-data is a proper Ember-CLI $ember install ember-data Version < 2.3, add the npm package and add the dependency via bower: npm install ember-data@v2.2.2 --save-dev bower install ember-data --save
  • 28. The road to EmberJs 2.0 Ember-data flow Application Store Adapter Cloud Promise (with records) Promise (json) find() find() XHR() XHR() returns
  • 29. The road to EmberJs 2.0 The Store The store is responsible for managing the lifecycle of your models. By loading the Ember Data library in your app, all of the routes and controllers in will get a new store property
  • 30. The road to EmberJs 2.0 The Adapter The adapter is responsible for translating requests from Ember-data into requests on your server.
  • 31. The road to EmberJs 2.0 How it woks // app/models/news.js import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), createdBy: DS.attr('string'), createdAt: DS.attr('date'), comments: DS.hasMany('comment') }); // app/models/comment.js import DS from 'ember-data'; export default DS.Model.extend({ message: DS.attr('string'), sentAt: DS.attr('date'), nickname: DS.attr('string'), post: DS.belongsTo('news') }); Retrieve multiple records var newses = this.store.findAll('news'); // => GET /posts var newses = this.store.peekAll('news'); // => no network request Query for multiple records this.store.query('news', { filter: { createdBy:'Lucio' } }).then(function(param_1) { });
  • 32. The road to EmberJs 2.0 More intuitive attribute bindings Ember 1.x (deprecated) <a {{bind-attr href=url}}>Click here</a> Ember 2.x <a href="{{url}}">Click here</a>
  • 33. The road to EmberJs 2.0 Components Based on of the W3C Web Components specification The specification is comprised of four smaller specifications; templates, decorators, shadow DOM, and custom elements.
  • 34. The road to EmberJs 2.0 Ember Components vs. Ember Views  EmberJs is a MVC .. V doesn't stand for view?   Components are a subclass of Ember.View   Views are generally found in the context of a controller.   Views sit behind a template and turn input into a semantic action in a controller or route.
  • 35. The road to EmberJs 2.0 Ember Components vs. Ember Views  EmberJs component do not have a context, they only know about the interface that they define  Components can be rendered into any context, making it decoupled and reusable.  In order to render properly a component you must supply it with data that it's expecting
  • 36. The road to EmberJs 2.0 Anatomy of an Ember Components An Ember component consists of a Handlebars template file and an accompanying Ember class (if needed extra interactivity with the component).
  • 37. The road to EmberJs 2.0 Generate an Ember Component $ ember generate component multitabs This will create three new files  a Handlebars file for our HTML  app/templates/components/multitabs.hbs  a JavaScript file for our component class app/components/multitabs.js  a test file tests/integration/components/multitabs-test.js
  • 38. The road to EmberJs 2.0 Using the Component Open the application template app/templates/application.hbs Add in the following after the h3 tag to use the component. {{multitabs}}
  • 39. The road to EmberJs 2.0 Add dynamic data $ ember generate route application This will generate app/routes/application.js. Open this up and add a model property: export default Ember.Route.extend({ model: function(){ }); });
  • 40. The road to EmberJs 2.0 Add Polymer to Ember project $ ember new PolymerProject $ bower install polymer --save
  • 41. The road to EmberJs 2.0 // Brocfile.js ... var EmberApp = require('ember-cli/lib/broccoli/ember-app'); ... var app = new EmberApp(); ... var polymer = pickFiles('bower_components/', { srcDir: '', files: [ 'webcomponentsjs/webcomponents.js', 'polymer/polymer.html' // 'polymer/polymer.js' ], destDir: '/assets' }); module.exports = mergeTrees([ polymer, app.toTree()]); // Index.html ... <script src="assets/webcomponentsjs/webcomponents.js"></script> ...
  • 42. The road to EmberJs 2.0 Resources and References https://github.com/emberjs/data https://github.com/emberjs/rfcs/pull/15 http://ember-cli.com/ http://code.tutsplus.com/tutorials/ember-components-a- deep-dive--net-35551 http://www.sitepoint.com/understanding-components-in- ember-2/
  • 43. The road to EmberJs 2.0 Questions? https://www.flickr.com/photos/derek_b/3046770021/
  • 44. Thanks! ROME 18-19 MARCH 2016 l.grenzi@gmail.com Dogwolf lucio.grenzi All pictures belong to their respective authors