SlideShare a Scribd company logo
1 of 99
Download to read offline
Client-side MVC
with Backbone.js
igloo



igloolab.com       michele.berto.li
 @iloveigloo       @MicheleBertoli
Lago di Garda
Lago di Garda


                          jQuery
                      HTML5 UPLOADER                       JOBBERONE
                     igloolab.com/jquery-html5-uploader   jobberone.com




  SHARP SQUARE
igloolab.com/sharpsquare
                                                                  KOALA
                              POMODORO WEBAPP                   koooala.com
                              pomodorowebapp.com
Agenda
Why Backbone.js   06:00 min


Architecture      14:00 min


Real World        05:00 min


Tips & Tricks     06:00 min


Extras            04:00 min


Questions         05:00 min
Why
Backbone.js
Why Backbone.js


From server-side to client-side
Why Backbone.js


From server-side to client-side
We need efficient tools
Why Backbone.js

jQuery is cool but…
Why Backbone.js

jQuery is cool but…
We have to store object informations into
the DOM

 var list = "";
 $.each(data, function (index, value) {
   list += "<li id="item-" + value.Id + "">" + value.Name + "</li>";
 });
 $("ul").append(list);
Why Backbone.js

jQuery is cool but…
We have to store object informations into
the DOM

 var list = "";
 $.each(data, function (index, value) {
   list += "<li id="item-" + value.Id + "">" + value.Name + "</li>";
 });
 $("ul").append(list);
Why Backbone.js
jQuery is cool but…
jQuery callback hell

 $.getJSON("/Items", function (data) {

   var list = "";
   $.each(data, function (index, value) {
     list += "<li id="item-" + value.Id + "">" + value.Name + "</li>";
   });
   $("ul").append(list);

   $("li").click(function () {
     var $this = $(this);
     var id = $this.attr("id").replace("item-", "");
     $.post("/Items", { id: id }, function () {
        $this.fadeOut(function () {
           $this.remove();
        });
     });
   });

 });
Why Backbone.js
jQuery is cool but…
jQuery callback hell

 $.getJSON("/Items", function (data) {

   var list = "";
   $.each(data, function (index, value) {
     list += "<li id="item-" + value.Id + "">" + value.Name + "</li>";
   });
   $("ul").append(list);

   $("li").click(function () {
     var $this = $(this);
     var id = $this.attr("id").replace("item-", "");
     $.post("/Items", { id: id }, function () {
        $this.fadeOut(function () {
           $this.remove();
        });
     });
   });

 });
Why Backbone.js



“It's all too easy to create JavaScript
applications that end up as tangled piles of
jQuery selectors and callbacks.”
Why Backbone.js

So, what do we need?
 •   Abstraction.
 •   Decoupling UI from Data.
 •   No more callbacks.
Why Backbone.js

So, what do we need? (More practically)
• A RESTful service based data layer.

• Events (to keep UI and data up-to-date).

• A template engine.

• A solid routing system.

• All the above things wrapped into a lightweight
 JavaScript framework.
Why Backbone.js



   It exists and it’s called:
         Backbone.js
Architecture
Architecture



               Oct 13th, 2010




   Jeremy
  Ashkenas
Architecture


http://documentcloud.github.com/backbone

https://github.com/documentcloud/backbone

@documentcloud

#documentcloud on IRC

https://groups.google.com/forum/#!forum/backbonejs
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture

Backbone.js gives structure to web
applications by providing models with key-
value binding and custom events,
collections with a rich API of enumerable
functions, views with declarative event
handling, and connects it all to your existing
API over a RESTful JSON interface.
Architecture


Dependencies:
• jQuery or Zepto

•   Underscore.js
•   Json2.js
Architecture


MVC
Model / Collection
Template (View)
View (Controller)
Router
Architecture


MVC
Model / Collection
Template (View)
View (Controller)
Router
Architecture


MVC
Model / Collection
Template (View)
View (Controller)
Router
Architecture


MVC
Model / Collection
Template (View)
View (Controller)
Router
Architecture


MVC
Model / Collection
Template (View)
View (Controller)
Router
Model
• Representing data
  (auto-generated).
• Handling persistence.

• Throws events.

• Reusable.
Architecture
Model / Collection - View - Template - Router - Utilities




Model

•   Fetch                                                   HTTP GET      /url
•   Save (new)                                              HTTP POST     /url
•   Save                                                    HTTP PUT      /url/id
•   Destroy                                                 HTTP DELETE   /url/id
Architecture
Model / Collection - View - Template - Router - Utilities




     var Item = Backbone.Model.extend({
       idAttribute: “Id”,
       urlRoot: “/Items”
     });
Architecture
Model / Collection - View - Template - Router - Utilities




    var item = new Item();
    item.set({
       Name: “Igloo”
    }); // trigger change
    item.save(); // trigger sync
Architecture
Model / Collection - View - Template - Router - Utilities



Model
• extend                                                • toJSON       • changedAttributes
•   constructor / initialize                            • fetch        • previous
•   get                                                 • save         • previousAttributes
•   set                                                 • destroy
•   escape                                              • validate
•   has                                                 • isValid
•   unset                                               • url
•   clear                                               • urlRoot
•   id                                                  • parse
•   idAttribute                                         • clone
•   cid                                                 • isNew
• attributes                                            • change
• defaults                                              • hasChanged
Collection
•   A list of models.
•   Underscore methods.
Architecture
Model / Collection - View - Template - Router - Utilities




    var Items = Backbone.Collection.extend({
      model: Item,
      url: "/Items"
    });
Architecture
Model / Collection - View - Template - Router - Utilities




     var items = new Items();
     items.fetch(); // trigger reset
Architecture
Model / Collection - View - Template - Router - Utilities




     items.comparator = function(item) {
        return item.get("Name");
     };
Architecture
Model / Collection - View - Template - Router - Utilities




Collection
• extend                                      • getByCid     • etch

• model                                       • at           • eset

• constructor / initialize                    • length       • create

• models                                      • comparator

• toJSON                                      • sort

• add                                         • pluck

• remove                                      • url

• get                                         • parse
Architecture
Model / Collection - View - Template - Router - Utilities




Collection                                                  • sortBy
                                                            • groupBy
• forEach (each)                                            • sortedIndex
• map                                                       • shuffle
• reduce (foldl, inject)                                    • toArray
• reduceRight (foldr)                                       • size
• find (detect)                                             • first
• filter (select)                                           • initial
• reject                                                    • rest
• every (all)                                               • last
• some (any)                                                • without
• include                                                   • indexOf
• invoke                                                    • lastIndexOf
• max                                                       • isEmpty
• min                                                       • chain
View
•   Manipulates the DOM.
•   Delegates DOM events.
•   Has a Model / Collection.
Architecture
Model / Collection - View - Template - Router - Utilities




                                                            View

  View (Collection)



                                                                   View (Model)
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




   var ListView = Backbone.View.extend({
     el: $("ul"),
     initialize: function () {
        this.collection.bind("reset", this.render, this);
     },
     render: function () {
        this.collection.each(this.addItem, this);
        return this;
     },
     addItem: function (item) {
        var itemView = new ItemView({                       var ItemView = Backbone.View.extend({
           model: item                                        tagName: "li",
        });                                                   render: function () {
        this.$el.append(itemView.el);                           this.$el.text(this.model.get("Name"));
        itemView.render();                                      return this;
     }                                                        }
   });                                                      });
Architecture
Model / Collection - View - Template - Router - Utilities




     var items = new Items();
     var listView = new ListView({
        collection: items
     });
     items.fetch();
Architecture
Model / Collection - View - Template - Router - Utilities




View
  • $ (jQuery or Zepto)                                     • extend

  • render                                                  • constructor / initialize

  • remove                                                  • el

  • make                                                    • $el

  • delegateEvents                                          • setElement

  • undelegateEvents                                        • attributes
Template            (Underscore.js)


Compiles JavaScript templates into functions
that can be evaluated for rendering.

•   Mustache
•   jQuery-tmpl
Architecture
Model / Collection - View - Template - Router - Utilities




     <script type="text/template" id="item-template">
       <li>
          <%= Name %>
       </li>
     </script>
Architecture
Model / Collection - View - Template - Router - Utilities




     var ItemView = Backbone.View.extend({
       …
       template: _.template($("#item-template").html()),
       ...
       render: function () {
           this.$el.html(this.template(this.model.toJSON()));
           return this;
       }
       …
     });
Router
•   Maps urls to function.
•   Enable history / bookmarking.
Architecture
Model / Collection - View - Template - Router - Utilities




     var AppRouter = Backbone.Router.extend({
       routes: {
          "": "initialize“
       },
       initialize: function () {
          …
       }
     });
Architecture
Model / Collection - View - Template - Router - Utilities




   window.AppRouter = Backbone.Router.extend({
     routes: {
        "": "loadInvoices",
        "/add": "addInvoice",
        "/show/:id": "showInvoice",
        "/edit/:id": "editInvoice“
     },
     loadInvoices: function () {
        …
     },
     addInvoice: function () {
        …
     },
     showInvoice: function (id) {
        …
     },
     editInvoice: function (id) {
        …
     }
   });
Architecture
Model / Collection - View - Template - Router - Utilities




Router
• extend
• routes
• constructor / initialize
• route
• navigate
Utilities
•   History
•   Sync
•   Utility
Architecture



                      Model /Collection




                                           Data
 Router        View                       Source


                      Template
Real
World
Real World

Polar management
• Smart invoicing web application



Technologies
• .NET RESTful Web Services / MS SQL
• Backbone.js
Real World

             Polar management
Real World
Real World
Real World


Polar management
 window.AppRouter = Backbone.Router.extend({
   routes: {
      …
      "/modifica/:id": "editInvoice“
   },
   editInvoice: function (id) {
      …
   }
 });
Real World


Polar management
 window.AppRouter = Backbone.Router.extend({
   routes: {
      …
      "/modifica/:id": "editInvoice“
   },
   editInvoice: function (id) {
      …
   }
 });
Real World

Koala
• Social media analytics



Technologies
• NET RESTful Web Services / RavenDB
• Backbone.js
• Highcharts.js
Real World
Real World
Real World

Koala
 window.Logs = Backbone.Collection.extend({
   model: Log,
   url: "/Data",
   comparator: function (log) {
      return log.get("Date");
   },
   sum: function (field) {
      return this.reduce(function (memo, log) {
         return memo + log.get(field);
      }, 0);
   }
 });
Real World

Koala
 window.Logs = Backbone.Collection.extend({
   model: Log,
   url: "/Data",
   comparator: function (log) {
      return log.get("Date");
   },
   sum: function (field) {
      return this.reduce(function (memo, log) {
         return memo + log.get(field);
      }, 0);
   }
 });
Real World

Koala
 window.Logs = Backbone.Collection.extend({
   model: Log,
   url: "/Data",
   comparator: function (log) {
      return log.get("Date");
   },
   sum: function (field) {
      return this.reduce(function (memo, log) {
         return memo + log.get(field);
      }, 0);
   }
 });
Real World

             Linkedin
Real World

             FourSquare
Real World

             WunderKit
Real World

             Groupon
Real World


             Basecamp
3




Tips &
Tricks
Tips & Tricks

idAttribute

 idAttribute: “id”

 // CouchDB
 idAttribute: “_id”

 // .NET
 idAttribute: “Id”
Tips & Tricks


            Related Models
Tips & Tricks

Related Models

 var Invoice = Backbone.Model.extend({
   idAttribute: “Id”
 });

 var Invoices = Backbone.Collection.extend({
   model: Invoice,
   url: "/Invoices"
 });
Tips & Tricks

                Related Models
Tips & Tricks

                Related Models
Tips & Tricks

Related Models

 var InvoiceDetail = Backbone.Model.extend({
   idAttribute: “Id”
 });

 var InvoiceDetails = Backbone.Collection.extend({
   model: InvoiceDetail,
   url: "/InvoiceDetails“
 });
Tips & Tricks
Related Models

 var Invoice = Backbone.Model.extend({
   idAttribute: "Id",
   initialize: function () {
      this.setInvoiceDetails();
   },
   setInvoiceDetails: function () {
      this.set({
        InvoiceDetails: new InvoiceDetails(this.get("InvoiceDetails"))
      });
   }
 });
Tips & Tricks

                Related Models
Tips & Tricks

                Related Models
Tips & Tricks
Related Models

 var Invoice = Backbone.Model.extend({
   idAttribute: "Id",
   initialize: function () {
      this.setInvoiceDetails();
      this.bind("sync", this.setInvoiceDetails);
   },
   setInvoiceDetails: function () {
      this.set({
        InvoiceDetails: new InvoiceDetails(this.get("InvoiceDetails"))
      });
   }
 });
Extras
Extras

Plugins
• Backbone-Nested
• Backbone.Memento
• Backbone.Validations
• Backbone.localStorage
• backbone.couchdb.js
• …
https://github.com/documentcloud/backbone/wiki/Extensions%2C-
Plugins%2C-Resources
Extras


• http://sproutcore.com (Apple/iCloud)

• http://knockoutjs.com

• http://emberjs.com

• http://batmanjs.org (Shopify)
Extras



Cheat Sheet
• http://www.igloolab.com/downloads/backbone-cheatsheet.pdf
Backbone.js
+
• Lightweight
• Powerful
• Code is clean (and maintainable)


-
• Too verbose (for small applications)
3
  Lago di Garda


Questions ?

    Grazie
    www.igloolab.com
      @iloveigloo

More Related Content

What's hot

Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Vagmi Mudumbai
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJSAaronius
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapWebFrameworks
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
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 Juliana Lucena
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습지수 윤
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Mongoose and MongoDB 101
Mongoose and MongoDB 101Mongoose and MongoDB 101
Mongoose and MongoDB 101Will Button
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
龍華大學前端技術分享 Part2
龍華大學前端技術分享 Part2龍華大學前端技術分享 Part2
龍華大學前端技術分享 Part2Jia-Long Yeh
 
An in-depth look at jQuery UI
An in-depth look at jQuery UIAn in-depth look at jQuery UI
An in-depth look at jQuery UIPaul Bakaus
 
Javascript and jQuery intro
Javascript and jQuery introJavascript and jQuery intro
Javascript and jQuery introwaw325
 
Backbone.js and friends
Backbone.js and friendsBackbone.js and friends
Backbone.js and friendsGood Robot
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial추근 문
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajaxbaygross
 
Mongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsMongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsYuriy Bogomolov
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
 

What's hot (20)

Backbone js
Backbone jsBackbone js
Backbone js
 
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
Building Single Page Apps with Backbone.js, Coffeescript and Rails 3.1
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-Bootstrap
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
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
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
Mongoose and MongoDB 101
Mongoose and MongoDB 101Mongoose and MongoDB 101
Mongoose and MongoDB 101
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
龍華大學前端技術分享 Part2
龍華大學前端技術分享 Part2龍華大學前端技術分享 Part2
龍華大學前端技術分享 Part2
 
An in-depth look at jQuery UI
An in-depth look at jQuery UIAn in-depth look at jQuery UI
An in-depth look at jQuery UI
 
Javascript and jQuery intro
Javascript and jQuery introJavascript and jQuery intro
Javascript and jQuery intro
 
Backbone.js and friends
Backbone.js and friendsBackbone.js and friends
Backbone.js and friends
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Mongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsMongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.js
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 

Viewers also liked

いまさら聞けない!?Backbone.js 超入門
いまさら聞けない!?Backbone.js 超入門いまさら聞けない!?Backbone.js 超入門
いまさら聞けない!?Backbone.js 超入門Kohei Kadowaki
 
BACKBONE.JSによるWebアプリケーション開発について
BACKBONE.JSによるWebアプリケーション開発についてBACKBONE.JSによるWebアプリケーション開発について
BACKBONE.JSによるWebアプリケーション開発についてToshio Ehara
 
はじめよう Backbone.js
はじめよう Backbone.jsはじめよう Backbone.js
はじめよう Backbone.jsHiroki Toyokawa
 
最強オブジェクト指向言語 JavaScript 再入門!
最強オブジェクト指向言語 JavaScript 再入門!最強オブジェクト指向言語 JavaScript 再入門!
最強オブジェクト指向言語 JavaScript 再入門!Yuji Nojima
 
5分でわかる?Backbone.js ことはじめ
5分でわかる?Backbone.js ことはじめ5分でわかる?Backbone.js ことはじめ
5分でわかる?Backbone.js ことはじめKohei Kadowaki
 
BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)Ryuma Tsukano
 
Parse.comと始めるBackbone.js入門(jscafe7)
Parse.comと始めるBackbone.js入門(jscafe7)Parse.comと始めるBackbone.js入門(jscafe7)
Parse.comと始めるBackbone.js入門(jscafe7)Ryuma Tsukano
 
BACKBONE.JSでMVC始めませんか?
BACKBONE.JSでMVC始めませんか?BACKBONE.JSでMVC始めませんか?
BACKBONE.JSでMVC始めませんか?Toshio Ehara
 
re:Titanium 今ここでもう一度、はじめての Titanium #2
re:Titanium 今ここでもう一度、はじめての Titanium #2re:Titanium 今ここでもう一度、はじめての Titanium #2
re:Titanium 今ここでもう一度、はじめての Titanium #2Ryutaro Miyashita
 
Rendr入門: サーバサイドで(も)動かす、Backbone.js
Rendr入門: サーバサイドで(も)動かす、Backbone.jsRendr入門: サーバサイドで(も)動かす、Backbone.js
Rendr入門: サーバサイドで(も)動かす、Backbone.jsMasahiko Tachizono
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationEyal Vardi
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsMark
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à MarionetteRaphaël Lemaire
 
Backbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The WorldBackbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The Worldharshit040591
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyAzat Mardanov
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.jsJonathan Weiss
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.jsRoman Kalyakin
 

Viewers also liked (20)

いまさら聞けない!?Backbone.js 超入門
いまさら聞けない!?Backbone.js 超入門いまさら聞けない!?Backbone.js 超入門
いまさら聞けない!?Backbone.js 超入門
 
BACKBONE.JSによるWebアプリケーション開発について
BACKBONE.JSによるWebアプリケーション開発についてBACKBONE.JSによるWebアプリケーション開発について
BACKBONE.JSによるWebアプリケーション開発について
 
はじめよう Backbone.js
はじめよう Backbone.jsはじめよう Backbone.js
はじめよう Backbone.js
 
最強オブジェクト指向言語 JavaScript 再入門!
最強オブジェクト指向言語 JavaScript 再入門!最強オブジェクト指向言語 JavaScript 再入門!
最強オブジェクト指向言語 JavaScript 再入門!
 
5分でわかる?Backbone.js ことはじめ
5分でわかる?Backbone.js ことはじめ5分でわかる?Backbone.js ことはじめ
5分でわかる?Backbone.js ことはじめ
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)
 
Parse.comと始めるBackbone.js入門(jscafe7)
Parse.comと始めるBackbone.js入門(jscafe7)Parse.comと始めるBackbone.js入門(jscafe7)
Parse.comと始めるBackbone.js入門(jscafe7)
 
Aiming study#6pdf
Aiming study#6pdfAiming study#6pdf
Aiming study#6pdf
 
BACKBONE.JSでMVC始めませんか?
BACKBONE.JSでMVC始めませんか?BACKBONE.JSでMVC始めませんか?
BACKBONE.JSでMVC始めませんか?
 
re:Titanium 今ここでもう一度、はじめての Titanium #2
re:Titanium 今ここでもう一度、はじめての Titanium #2re:Titanium 今ここでもう一度、はじめての Titanium #2
re:Titanium 今ここでもう一度、はじめての Titanium #2
 
Rendr入門: サーバサイドで(も)動かす、Backbone.js
Rendr入門: サーバサイドで(も)動かす、Backbone.jsRendr入門: サーバサイドで(も)動かす、Backbone.js
Rendr入門: サーバサイドで(も)動かす、Backbone.js
 
Backbone.js入門
Backbone.js入門Backbone.js入門
Backbone.js入門
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 Validation
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à Marionette
 
Backbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The WorldBackbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The World
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General Assembly
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 

Similar to Client-side MVC with Backbone.js

初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料Shinichi Ogawa
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Backbonejs for beginners
Backbonejs for beginnersBackbonejs for beginners
Backbonejs for beginnersDivakar Gu
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJSZhang Xiaoxue
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
DevLOVE Beautiful Development - 第一幕 陽の巻
DevLOVE Beautiful Development - 第一幕 陽の巻DevLOVE Beautiful Development - 第一幕 陽の巻
DevLOVE Beautiful Development - 第一幕 陽の巻都元ダイスケ Miyamoto
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuerycolinbdclark
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGentkevinvw
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
CUST-1 Share Document Library Extension Points
CUST-1 Share Document Library Extension PointsCUST-1 Share Document Library Extension Points
CUST-1 Share Document Library Extension PointsAlfresco Software
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
State of search | drupalcamp ghent
State of search | drupalcamp ghentState of search | drupalcamp ghent
State of search | drupalcamp ghentJoris Vercammen
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 
State of search | drupal dinner
State of search | drupal dinnerState of search | drupal dinner
State of search | drupal dinnerJoris Vercammen
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTTkevinvw
 
Awesome html with ujs, jQuery and coffeescript
Awesome html with ujs, jQuery and coffeescriptAwesome html with ujs, jQuery and coffeescript
Awesome html with ujs, jQuery and coffeescriptAmir Barylko
 

Similar to Client-side MVC with Backbone.js (20)

初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Backbonejs for beginners
Backbonejs for beginnersBackbonejs for beginners
Backbonejs for beginners
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
DevLOVE Beautiful Development - 第一幕 陽の巻
DevLOVE Beautiful Development - 第一幕 陽の巻DevLOVE Beautiful Development - 第一幕 陽の巻
DevLOVE Beautiful Development - 第一幕 陽の巻
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
CUST-1 Share Document Library Extension Points
CUST-1 Share Document Library Extension PointsCUST-1 Share Document Library Extension Points
CUST-1 Share Document Library Extension Points
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
JS Essence
JS EssenceJS Essence
JS Essence
 
State of search | drupalcamp ghent
State of search | drupalcamp ghentState of search | drupalcamp ghent
State of search | drupalcamp ghent
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
State of search | drupal dinner
State of search | drupal dinnerState of search | drupal dinner
State of search | drupal dinner
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTT
 
Awesome html with ujs, jQuery and coffeescript
Awesome html with ujs, jQuery and coffeescriptAwesome html with ujs, jQuery and coffeescript
Awesome html with ujs, jQuery and coffeescript
 

More from iloveigloo

#7 - Client-side web apps, MVC and jQuery
#7 - Client-side web apps, MVC and jQuery#7 - Client-side web apps, MVC and jQuery
#7 - Client-side web apps, MVC and jQueryiloveigloo
 
#6 - Template Engine: Mustache.js
#6 - Template Engine: Mustache.js#6 - Template Engine: Mustache.js
#6 - Template Engine: Mustache.jsiloveigloo
 
#5 - CSS3 Gradients and Backgrounds
#5 - CSS3 Gradients and Backgrounds#5 - CSS3 Gradients and Backgrounds
#5 - CSS3 Gradients and Backgroundsiloveigloo
 
#4 - CSS Selectors, CSS3 and Web typography
#4 - CSS Selectors, CSS3 and Web typography#4 - CSS Selectors, CSS3 and Web typography
#4 - CSS Selectors, CSS3 and Web typographyiloveigloo
 
#3 - Sectioning content and outline view
#3 - Sectioning content and outline view#3 - Sectioning content and outline view
#3 - Sectioning content and outline viewiloveigloo
 
#2 - CSS Layouts Overview
#2 - CSS Layouts Overview#2 - CSS Layouts Overview
#2 - CSS Layouts Overviewiloveigloo
 
#1 - HTML5 Overview
#1 - HTML5 Overview#1 - HTML5 Overview
#1 - HTML5 Overviewiloveigloo
 
Shoppingsquare
ShoppingsquareShoppingsquare
Shoppingsquareiloveigloo
 

More from iloveigloo (9)

#7 - Client-side web apps, MVC and jQuery
#7 - Client-side web apps, MVC and jQuery#7 - Client-side web apps, MVC and jQuery
#7 - Client-side web apps, MVC and jQuery
 
#6 - Template Engine: Mustache.js
#6 - Template Engine: Mustache.js#6 - Template Engine: Mustache.js
#6 - Template Engine: Mustache.js
 
#5 - CSS3 Gradients and Backgrounds
#5 - CSS3 Gradients and Backgrounds#5 - CSS3 Gradients and Backgrounds
#5 - CSS3 Gradients and Backgrounds
 
#4 - CSS Selectors, CSS3 and Web typography
#4 - CSS Selectors, CSS3 and Web typography#4 - CSS Selectors, CSS3 and Web typography
#4 - CSS Selectors, CSS3 and Web typography
 
$$$ SOLDI $$$
$$$ SOLDI $$$$$$ SOLDI $$$
$$$ SOLDI $$$
 
#3 - Sectioning content and outline view
#3 - Sectioning content and outline view#3 - Sectioning content and outline view
#3 - Sectioning content and outline view
 
#2 - CSS Layouts Overview
#2 - CSS Layouts Overview#2 - CSS Layouts Overview
#2 - CSS Layouts Overview
 
#1 - HTML5 Overview
#1 - HTML5 Overview#1 - HTML5 Overview
#1 - HTML5 Overview
 
Shoppingsquare
ShoppingsquareShoppingsquare
Shoppingsquare
 

Recently uploaded

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 

Recently uploaded (20)

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 

Client-side MVC with Backbone.js

  • 1.
  • 3. igloo igloolab.com michele.berto.li @iloveigloo @MicheleBertoli
  • 5. Lago di Garda jQuery HTML5 UPLOADER JOBBERONE igloolab.com/jquery-html5-uploader jobberone.com SHARP SQUARE igloolab.com/sharpsquare KOALA POMODORO WEBAPP koooala.com pomodorowebapp.com
  • 7. Why Backbone.js 06:00 min Architecture 14:00 min Real World 05:00 min Tips & Tricks 06:00 min Extras 04:00 min Questions 05:00 min
  • 10. Why Backbone.js From server-side to client-side We need efficient tools
  • 12. Why Backbone.js jQuery is cool but… We have to store object informations into the DOM var list = ""; $.each(data, function (index, value) { list += "<li id="item-" + value.Id + "">" + value.Name + "</li>"; }); $("ul").append(list);
  • 13. Why Backbone.js jQuery is cool but… We have to store object informations into the DOM var list = ""; $.each(data, function (index, value) { list += "<li id="item-" + value.Id + "">" + value.Name + "</li>"; }); $("ul").append(list);
  • 14. Why Backbone.js jQuery is cool but… jQuery callback hell $.getJSON("/Items", function (data) { var list = ""; $.each(data, function (index, value) { list += "<li id="item-" + value.Id + "">" + value.Name + "</li>"; }); $("ul").append(list); $("li").click(function () { var $this = $(this); var id = $this.attr("id").replace("item-", ""); $.post("/Items", { id: id }, function () { $this.fadeOut(function () { $this.remove(); }); }); }); });
  • 15. Why Backbone.js jQuery is cool but… jQuery callback hell $.getJSON("/Items", function (data) { var list = ""; $.each(data, function (index, value) { list += "<li id="item-" + value.Id + "">" + value.Name + "</li>"; }); $("ul").append(list); $("li").click(function () { var $this = $(this); var id = $this.attr("id").replace("item-", ""); $.post("/Items", { id: id }, function () { $this.fadeOut(function () { $this.remove(); }); }); }); });
  • 16. Why Backbone.js “It's all too easy to create JavaScript applications that end up as tangled piles of jQuery selectors and callbacks.”
  • 17. Why Backbone.js So, what do we need? • Abstraction. • Decoupling UI from Data. • No more callbacks.
  • 18. Why Backbone.js So, what do we need? (More practically) • A RESTful service based data layer. • Events (to keep UI and data up-to-date). • A template engine. • A solid routing system. • All the above things wrapped into a lightweight JavaScript framework.
  • 19. Why Backbone.js It exists and it’s called: Backbone.js
  • 21. Architecture Oct 13th, 2010 Jeremy Ashkenas
  • 23. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 24. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 25. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 26. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 27. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 28. Architecture Backbone.js gives structure to web applications by providing models with key- value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • 29. Architecture Dependencies: • jQuery or Zepto • Underscore.js • Json2.js
  • 30. Architecture MVC Model / Collection Template (View) View (Controller) Router
  • 31. Architecture MVC Model / Collection Template (View) View (Controller) Router
  • 32. Architecture MVC Model / Collection Template (View) View (Controller) Router
  • 33. Architecture MVC Model / Collection Template (View) View (Controller) Router
  • 34. Architecture MVC Model / Collection Template (View) View (Controller) Router
  • 35. Model • Representing data (auto-generated). • Handling persistence. • Throws events. • Reusable.
  • 36. Architecture Model / Collection - View - Template - Router - Utilities Model • Fetch HTTP GET /url • Save (new) HTTP POST /url • Save HTTP PUT /url/id • Destroy HTTP DELETE /url/id
  • 37. Architecture Model / Collection - View - Template - Router - Utilities var Item = Backbone.Model.extend({ idAttribute: “Id”, urlRoot: “/Items” });
  • 38. Architecture Model / Collection - View - Template - Router - Utilities var item = new Item(); item.set({ Name: “Igloo” }); // trigger change item.save(); // trigger sync
  • 39. Architecture Model / Collection - View - Template - Router - Utilities Model • extend • toJSON • changedAttributes • constructor / initialize • fetch • previous • get • save • previousAttributes • set • destroy • escape • validate • has • isValid • unset • url • clear • urlRoot • id • parse • idAttribute • clone • cid • isNew • attributes • change • defaults • hasChanged
  • 40. Collection • A list of models. • Underscore methods.
  • 41. Architecture Model / Collection - View - Template - Router - Utilities var Items = Backbone.Collection.extend({ model: Item, url: "/Items" });
  • 42. Architecture Model / Collection - View - Template - Router - Utilities var items = new Items(); items.fetch(); // trigger reset
  • 43. Architecture Model / Collection - View - Template - Router - Utilities items.comparator = function(item) { return item.get("Name"); };
  • 44. Architecture Model / Collection - View - Template - Router - Utilities Collection • extend • getByCid • etch • model • at • eset • constructor / initialize • length • create • models • comparator • toJSON • sort • add • pluck • remove • url • get • parse
  • 45. Architecture Model / Collection - View - Template - Router - Utilities Collection • sortBy • groupBy • forEach (each) • sortedIndex • map • shuffle • reduce (foldl, inject) • toArray • reduceRight (foldr) • size • find (detect) • first • filter (select) • initial • reject • rest • every (all) • last • some (any) • without • include • indexOf • invoke • lastIndexOf • max • isEmpty • min • chain
  • 46. View • Manipulates the DOM. • Delegates DOM events. • Has a Model / Collection.
  • 47. Architecture Model / Collection - View - Template - Router - Utilities View View (Collection) View (Model)
  • 48. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 49. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 50. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 51. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 52. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 53. Architecture Model / Collection - View - Template - Router - Utilities var ListView = Backbone.View.extend({ el: $("ul"), initialize: function () { this.collection.bind("reset", this.render, this); }, render: function () { this.collection.each(this.addItem, this); return this; }, addItem: function (item) { var itemView = new ItemView({ var ItemView = Backbone.View.extend({ model: item tagName: "li", }); render: function () { this.$el.append(itemView.el); this.$el.text(this.model.get("Name")); itemView.render(); return this; } } }); });
  • 54. Architecture Model / Collection - View - Template - Router - Utilities var items = new Items(); var listView = new ListView({ collection: items }); items.fetch();
  • 55. Architecture Model / Collection - View - Template - Router - Utilities View • $ (jQuery or Zepto) • extend • render • constructor / initialize • remove • el • make • $el • delegateEvents • setElement • undelegateEvents • attributes
  • 56. Template (Underscore.js) Compiles JavaScript templates into functions that can be evaluated for rendering. • Mustache • jQuery-tmpl
  • 57. Architecture Model / Collection - View - Template - Router - Utilities <script type="text/template" id="item-template"> <li> <%= Name %> </li> </script>
  • 58. Architecture Model / Collection - View - Template - Router - Utilities var ItemView = Backbone.View.extend({ … template: _.template($("#item-template").html()), ... render: function () { this.$el.html(this.template(this.model.toJSON())); return this; } … });
  • 59. Router • Maps urls to function. • Enable history / bookmarking.
  • 60. Architecture Model / Collection - View - Template - Router - Utilities var AppRouter = Backbone.Router.extend({ routes: { "": "initialize“ }, initialize: function () { … } });
  • 61. Architecture Model / Collection - View - Template - Router - Utilities window.AppRouter = Backbone.Router.extend({ routes: { "": "loadInvoices", "/add": "addInvoice", "/show/:id": "showInvoice", "/edit/:id": "editInvoice“ }, loadInvoices: function () { … }, addInvoice: function () { … }, showInvoice: function (id) { … }, editInvoice: function (id) { … } });
  • 62. Architecture Model / Collection - View - Template - Router - Utilities Router • extend • routes • constructor / initialize • route • navigate
  • 63. Utilities • History • Sync • Utility
  • 64. Architecture Model /Collection Data Router View Source Template
  • 66. Real World Polar management • Smart invoicing web application Technologies • .NET RESTful Web Services / MS SQL • Backbone.js
  • 67. Real World Polar management
  • 70. Real World Polar management window.AppRouter = Backbone.Router.extend({ routes: { … "/modifica/:id": "editInvoice“ }, editInvoice: function (id) { … } });
  • 71. Real World Polar management window.AppRouter = Backbone.Router.extend({ routes: { … "/modifica/:id": "editInvoice“ }, editInvoice: function (id) { … } });
  • 72. Real World Koala • Social media analytics Technologies • NET RESTful Web Services / RavenDB • Backbone.js • Highcharts.js
  • 75. Real World Koala window.Logs = Backbone.Collection.extend({ model: Log, url: "/Data", comparator: function (log) { return log.get("Date"); }, sum: function (field) { return this.reduce(function (memo, log) { return memo + log.get(field); }, 0); } });
  • 76. Real World Koala window.Logs = Backbone.Collection.extend({ model: Log, url: "/Data", comparator: function (log) { return log.get("Date"); }, sum: function (field) { return this.reduce(function (memo, log) { return memo + log.get(field); }, 0); } });
  • 77. Real World Koala window.Logs = Backbone.Collection.extend({ model: Log, url: "/Data", comparator: function (log) { return log.get("Date"); }, sum: function (field) { return this.reduce(function (memo, log) { return memo + log.get(field); }, 0); } });
  • 78. Real World Linkedin
  • 79. Real World FourSquare
  • 80. Real World WunderKit
  • 81. Real World Groupon
  • 82. Real World Basecamp
  • 84. Tips & Tricks idAttribute idAttribute: “id” // CouchDB idAttribute: “_id” // .NET idAttribute: “Id”
  • 85. Tips & Tricks Related Models
  • 86. Tips & Tricks Related Models var Invoice = Backbone.Model.extend({ idAttribute: “Id” }); var Invoices = Backbone.Collection.extend({ model: Invoice, url: "/Invoices" });
  • 87. Tips & Tricks Related Models
  • 88. Tips & Tricks Related Models
  • 89. Tips & Tricks Related Models var InvoiceDetail = Backbone.Model.extend({ idAttribute: “Id” }); var InvoiceDetails = Backbone.Collection.extend({ model: InvoiceDetail, url: "/InvoiceDetails“ });
  • 90. Tips & Tricks Related Models var Invoice = Backbone.Model.extend({ idAttribute: "Id", initialize: function () { this.setInvoiceDetails(); }, setInvoiceDetails: function () { this.set({ InvoiceDetails: new InvoiceDetails(this.get("InvoiceDetails")) }); } });
  • 91. Tips & Tricks Related Models
  • 92. Tips & Tricks Related Models
  • 93. Tips & Tricks Related Models var Invoice = Backbone.Model.extend({ idAttribute: "Id", initialize: function () { this.setInvoiceDetails(); this.bind("sync", this.setInvoiceDetails); }, setInvoiceDetails: function () { this.set({ InvoiceDetails: new InvoiceDetails(this.get("InvoiceDetails")) }); } });
  • 95. Extras Plugins • Backbone-Nested • Backbone.Memento • Backbone.Validations • Backbone.localStorage • backbone.couchdb.js • … https://github.com/documentcloud/backbone/wiki/Extensions%2C- Plugins%2C-Resources
  • 96. Extras • http://sproutcore.com (Apple/iCloud) • http://knockoutjs.com • http://emberjs.com • http://batmanjs.org (Shopify)
  • 98. Backbone.js + • Lightweight • Powerful • Code is clean (and maintainable) - • Too verbose (for small applications)
  • 99. 3 Lago di Garda Questions ? Grazie www.igloolab.com @iloveigloo