66
Parse Apps with Ember.js Porting native to the web

Parse Apps with Ember.js

  • Upload
    mixonic

  • View
    4.559

  • Download
    1

Embed Size (px)

DESCRIPTION

Ember.js is a new JavaScript framework for building ambitiously complex web applications. Taking lessons from the iOS development platform and other JavaScript frameworks that came before it, Ember embraces the idea that our applications are more alike than they are dissimilar. It encourages coding by convention, testing, and MVC patterns. Building an app on Parse makes your data available via the Parse REST API. Using that API, ember-cli and Ember-Data, I’ll show you how to get started porting your native app to the mobile web. The live coded demo is here: http://emberjs.jsbin.com/lizep/7/edit?html,js,output

Citation preview

Page 1: Parse Apps with Ember.js

Parse Apps with Ember.js

Porting native to the web

Page 3: Parse Apps with Ember.js

201 Created

We build õ-age apps with Ember.js. We take teams from £ to • in no time flat.

Page 4: Parse Apps with Ember.js

https://gumroad.com/l/XlSx/

Page 5: Parse Apps with Ember.js

“You are not a special snowflake. You will benefit from shared tools

and abstractions.”

Yehuda Katz, co-creator of Ember.js

Page 6: Parse Apps with Ember.js

Unix

Page 7: Parse Apps with Ember.js

“Write programs that do one thing and do it well. Write programs to work together. Write

programs to handle text streams, because that is a universal interface.”

Doug McIlroy, Unix pioneer

Page 8: Parse Apps with Ember.js

Unix

Ember.js

Page 9: Parse Apps with Ember.js

“When you decide to not pick a public framework, you will end up with a framework anyway: your own.”

Ryan Florence, guy in Utah

Page 10: Parse Apps with Ember.js

Unix

Ember.js

Parse

Page 11: Parse Apps with Ember.js

“You are not a special snowflake. You will benefit from shared tools

and abstractions.”

Yehuda Katz, co-creator of Ember.js

Page 12: Parse Apps with Ember.js

PART 1. HISTORY

Page 13: Parse Apps with Ember.js
Page 14: Parse Apps with Ember.js
Page 15: Parse Apps with Ember.js

DB

WEBSITE APP

Page 16: Parse Apps with Ember.js

WEBSITE APP

HTML

Page 17: Parse Apps with Ember.js

HTML HTMLHTML

WEBSITE APP

Page 18: Parse Apps with Ember.js

HTML HTMLHTMLJSON

WEBSITE APP

Page 19: Parse Apps with Ember.js

HTML JSON (XML?)JSON

WEBSITE APP

Page 20: Parse Apps with Ember.js

WEBSITE APP API APP

JSON (XML?)HTMLJSON

Page 21: Parse Apps with Ember.js

JSON JSON JSON

WEBSITE APP API APP

HTMLJSON

Page 22: Parse Apps with Ember.js

JSON JSON(Different) HTML

WEBSITE APP API APP

HTML

Page 23: Parse Apps with Ember.js

JSON JSON(Different) HTML

WEBSITE APP API APP

HTML

StateFUL

STATELESSStateFUL

StateLESS, MAYbE?

Page 24: Parse Apps with Ember.js

JSON JSON(Different) HTML

WEBSITE APP API APP

HTML

StateFUL

STATELESSStateFUL

StateLESS, MAYbE?

Page 25: Parse Apps with Ember.js

JSON

API APP

JSON

StateFUL

STATELESS

Page 26: Parse Apps with Ember.js

Ember allows us to move complexity and state away from the server, and into

the browser.

Page 27: Parse Apps with Ember.js

APIs focus on domain logic, security and speed.

Page 28: Parse Apps with Ember.js

PART 2. FRAMEWORK CONCEPTS

Page 29: Parse Apps with Ember.js

Convention over Configuration

Page 30: Parse Apps with Ember.js

1 <html> 2 <body> 3 4 <script type="text/x-handlebars"> 5 <h2>Welcome to Ember.js</h2> 6 </script> 7 8 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 9 <script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.1.0.js"></script> 10 <script src="//builds.emberjs.com/tags/v1.2.0/ember.js"></script> 11 12 <script> 13 Ember.Application.create(); 14 </script> 15 16 </body> 17 </html>

Page 31: Parse Apps with Ember.js

•How Do I update the URL? •What object backs the template? •What iS the template named? •Where on THE DOM IS MY APP ATTACHED?

Page 32: Parse Apps with Ember.js

•How Do I update the URL? HASHCHANGE •What object backs the template? application cONTROLLER •What iS the template named? APPLICATION •Where on THE DOM IS MY APP ATTACHED? BODY TAG

Page 33: Parse Apps with Ember.js

•How Do I update the URL? history •What object backs the template? HOME cONTROLLER •What iS the template named? welcome •Where on THE DOM IS MY APP ATTACHED? #app

Page 34: Parse Apps with Ember.js

1 <html> 2 <body> 3 <div id="app"></div> 4 5 <script type="text/x-handlebars" id="welcome"> 6 <h2>Welcome to {{platform}}</h2> 7 </script> 8 9 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 10 <script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.1.0.js"></script> 11 <script src="//builds.emberjs.com/tags/v1.2.0/ember.js"></script> 12 13 <script> 14 var App = Ember.Application.create({ 15 rootElement: '#app' 16 }); 17 App.Router.map(function(){ 18 location: 'history' 19 }); 20 App.IndexRoute = Ember.Route.extend({ 21 renderTemplate: function(){ 22 this.render('welcome', { 23 controller: 'home' 24 }); 25 } 26 }); 27 App.HomeController = Ember.Controller.extend({ 28 platform: "Ember.js" 29 }); 30 </script> 31 32 </body> 33 </html>

Page 35: Parse Apps with Ember.js

URL Driven Development

Page 36: Parse Apps with Ember.js

http://myapp.dev

application.hbs

index.hbs

Page 37: Parse Apps with Ember.js

http://myapp.dev

1 {{! application.hbs }} 2 3 <div class="application-wrapper"> 4 {{outlet}} 5 </div>

1 {{! index.hbs }} 2 3 <h2>Hello Ember.js world!</h2>

Page 38: Parse Apps with Ember.js

http://myapp.dev/about

application.hbs

about.hbs

Page 39: Parse Apps with Ember.js

http://myapp.dev/about

1 {{! about.hbs }} 2 3 <h2>About my app</h2>

1 App.Route = Ember.Route.extend({ 2 // "index" is implied 3 this.route('about'); 4 });

1 {{! application.hbs }} 2 3 <div class="application-wrapper"> 4 {{outlet}} 5 </div>

1 {{! index.hbs }} 2 3 <h2>Hello Ember.js world!</h2>

Page 40: Parse Apps with Ember.js

http://myapp.dev/project/31

application.hbs

project.hbs

Page 41: Parse Apps with Ember.js

1 App.Route = Ember.Route.extend({ 2 // "index" is implied 3 this.route('about'); 4 this.route('project', {path: 'project/:project_id'}); 5 });

http://myapp.dev/project/31

1 {{! project.hbs }} 2 3 <h2>Project {{name}}</h2> 4 5 <p>Created at {{createdAt}}</p>

1 {{! about.hbs }} 2 3 <h2>About my app</h2>

1 {{! application.hbs }} 2 3 <div class="application-wrapper"> 4 {{outlet}} 5 </div>

1 {{! index.hbs }} 2 3 <h2>Hello Ember.js world!</h2>

Page 42: Parse Apps with Ember.js

http://myapp.dev/project/31/edit

application.hbs

project.hbs

project/edit.hbs

Page 43: Parse Apps with Ember.js

http://myapp.dev/project/31/edit

1 App.Route = Ember.Route.extend({ 2 // "index" is implied 3 this.route('about'); 4 this.resource('project', {path: 'project/:project_id'}, function(){ 5 // "index" is implied 6 this.route('edit'); 7 }); 8 });

1 {{! project.hbs }} 2 3 <h2>Project {{name}}</h2> 4 5 {{outlet}}

1 {{! project/index.hbs }} 2 3 <p>Created at {{createdAt}}</p>

1 {{! project/edit.hbs }} 2 3 {{input type="text" value="createdAt"}}

1 {{! application.hbs }} 2 3 <div class="application-wrapper"> 4 {{outlet}} 5 </div>

Page 44: Parse Apps with Ember.js

Extend the Web Forward

Page 45: Parse Apps with Ember.js

•Soon: Ember will be module aware (no global app.) •soon: Ember will be written with es6 modules •Ember components <- Web components •primitive extensions match es6 (forEach etc.) •Where on THE DOM IS MY APP ATTACHED? •Ember promises (RSVP) are A+

Page 46: Parse Apps with Ember.js

Ember is built on concepts you already know.

Page 47: Parse Apps with Ember.js

MVC, BUT MORE LIKE than

Page 48: Parse Apps with Ember.js

Classes and mixins (ala RUBy)

Page 49: Parse Apps with Ember.js

properties have setters and getters (like Python)

Page 50: Parse Apps with Ember.js

If you get lost with Ember, finding a parallel concept may help.

Page 51: Parse Apps with Ember.js

Think about the problem before getting hung up on the API.

Page 52: Parse Apps with Ember.js

let’s write some code.

Page 53: Parse Apps with Ember.js

Quickie Todo List w/ Ember & Parse

http://emberjs.jsbin.com/lizep/3/edit

Page 54: Parse Apps with Ember.js

1. Parse 2. Ember.js 3. Ember-Data

Page 55: Parse Apps with Ember.js

1. Parse 2. Ember.js 3. Ember-Data 4. Ember-Parse Adapter

https://github.com/clintjhill/ember-parse-adapter

Page 56: Parse Apps with Ember.js

Why Ember-Data?

Page 57: Parse Apps with Ember.js

• Identity Map • Relationships • Schema-compat • Cross-API Relationships

https://github.com/clintjhill/ember-parse-adapter

Page 58: Parse Apps with Ember.js

NO BACKBONE.js

Page 59: Parse Apps with Ember.js

http://emberjs.jsbin.com/lizep/7/edit

LIVE CODED:

Page 60: Parse Apps with Ember.js

www.turnstilelive.com

m.turnstilelive.com

Page 61: Parse Apps with Ember.js
Page 62: Parse Apps with Ember.js

What does Ember-Parse Adapter support?

Page 63: Parse Apps with Ember.js

1. Relationships 2. CRUD 3. Authentication 4. Data-types (GeoPoint

etc.)

Page 64: Parse Apps with Ember.js

What does Ember-Parse Adapter not support?

Page 65: Parse Apps with Ember.js

1. Array Relationships 2. My Extravagant

Lifestyle 3. Push 4. Analytics 5. ACL

Page 66: Parse Apps with Ember.js

Thanks!

@mixonic

httP://madhatted.com

[email protected]