Ember,js: Hipster Hamster Framework

20
Ember.js: Hipster Hamster Framework

description

High level introduction to Ember focusing less on code and more on what it's all about

Transcript of Ember,js: Hipster Hamster Framework

Page 1: Ember,js: Hipster Hamster Framework

Ember.js: Hipster Hamster Framework

Page 2: Ember,js: Hipster Hamster Framework

http://www.reddit.com/r/webdev/comments/18n0o5/please_explain_like_im_five_what_are_emberjs/

Top answer:

-Reddit is great for lots of things but not everything-Not a how to-High level before diving in

Page 3: Ember,js: Hipster Hamster Framework

http://www.reddit.com/r/webdev/comments/18n0o5/please_explain_like_im_five_what_are_emberjs/

Top answer:

-Reddit is great for lots of things but not everything-Not a how to-High level before diving in

Page 4: Ember,js: Hipster Hamster Framework

Bindings

-Keep 2 objects in sync-Country will update its president name whenever you change president

Page 5: Ember,js: Hipster Hamster Framework

Computed Properties

Auto-updating Templates

-Create functions that can be used as properties-Templates are bindings aware so they update when you data changes

Page 6: Ember,js: Hipster Hamster Framework

Interactive(MVC

Framework)Static

(No JavaScript)

-When to use Ember? -Spectrum: Static sites don’t need JS, interactive sites do-Can get away with just JQuery but JQuery relies on the HTML-Changing the HTML can break functionality unless you track of changes in the HTML done by JQuery necessary = lots of work

Page 7: Ember,js: Hipster Hamster Framework

Interactive(MVC

Framework)Static

(No JavaScript) JQuery

-When to use Ember? -Spectrum: Static sites don’t need JS, interactive sites do-Can get away with just JQuery but JQuery relies on the HTML-Changing the HTML can break functionality unless you track of changes in the HTML done by JQuery necessary = lots of work

Page 8: Ember,js: Hipster Hamster Framework

-Popular alternatives-Angular is most popular to compare against right now-Ember provides more than these frameworks do, but as always, use the right tool for the right job

Page 9: Ember,js: Hipster Hamster Framework

http://todomvc.com/

Website that shows different implementations of a single page Todo list

Page 10: Ember,js: Hipster Hamster Framework

http://emberjs.com/ember-users/

Ember is new but is production ready

Page 11: Ember,js: Hipster Hamster Framework

“A framework for creating ambitious

web applications.”

-Ambitious is the key word-Goal is to compete with native apps and so borrows heavily from developing native applications, especially from Cocoa

Page 12: Ember,js: Hipster Hamster Framework

“Convention over configuration”

-Like Rails-Code generated that you’ll never see

Page 13: Ember,js: Hipster Hamster Framework

Router this.resource('tables')App.TablesRoute

Controller App.TablesController

Model App.Table

View App.TablesView

Template tables

Tables Resource

-5 core pieces of Ember-Naming convention is CRITICAL-Since Ember does a lot for you, if you don’t name things correctly, it won’t work

Page 14: Ember,js: Hipster Hamster Framework

Views Controllers ORM Data Store

Rails

JS

Ember

ERBHTML ActionController ActiveRecord mySQL/

Postgres

$.html $.live $.ajax Resful API

Handlebars Ember.js Ember Data Resful API

https://speakerdeck.com/ardell/ember-dot-js-rails

-Rails MVC is NOT Ember MVC-JS works but harder to ensure data and views match-Ember takes over to help with that

Page 15: Ember,js: Hipster Hamster Framework

- Ember uses and builds upon Handlebars.js- Extension of the Mustache templating language- Helps keep logic from the view

Page 16: Ember,js: Hipster Hamster Framework

<script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1>{{title}}</h1> <div class="body"> {{body}} </div></div></script>

var source = $("#entry-template").html();var template = Handlebars.compile(source);

var context = {title: "My New Post", body: "This is my first post!"}var html = template(context);

<div class="entry"> <h1>My New Post</h1> <div class="body"> This is my first post! </div></div>

-Regular HTML with handlebars expression {{ content }}-Add template through script tags-Compile a template in JavaScript with Handlebars.compile-Get HTML by executing the template with a context

Page 17: Ember,js: Hipster Hamster Framework

+HTML

Ember uses {{}} and extends functionality

Page 18: Ember,js: Hipster Hamster Framework

Billy Shih@tobillys

github.com/bbshih