SlideShare a Scribd company logo
BACKBONE JS IN ACTION
@UshaGuduri
AGENDA
Web Apps Back Then
Web Apps Now
What the heck is the problem?!!
What is BackboneJS?
Lets get hands-on
Whats out there
ONCE UPON A TIME...
RIGHT HERE, RIGHT NOW!
HOW DO WE ACHIEVE DYNAMISM?
“ The best thing about JavaScript is its
implementation of functions. ”
JQUERY
AJAX
$(function () {
// do stuff after DOM has loaded
});
$.ajax({
url: "/myurl",
beforeSend: function ( xhr ) {
xhr.overrideMimeType("text/plain;");
},
success: function(response) {
// I AM INVINCIBLE!
},
error: function(response) {
// What, I FAILED ? :O
}
})
WHAT THE HECK IS THE PROBLEM?!!!
Lets check Boston.com
“ 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. ”
6.3KB
Packed and gzipped !!
BACKBONEJS CONSTRUCTS
Model (and Collection): Application (domain) data objects
that are retrieved from and persisted to the server
View: HTML presentation of the data stored in the models
and DOM 'controller'
Router: Controller that saves the state of the application
via a url hash
History: Global router (per frame) to handle hashchange
events or pushState
Events: Module that can be mixed in to any object, giving
the object the ability to bind and trigger custom named
events.
Sync: Manages actual persistence by a "function that
Backbone calls every time it attempts to read or save a
model to the server."
Backbone js in action
HOW TO MAP BACKBONE TO MVC
MODEL
extend, initialize(constructor), url/urlRoot, id/idAttribute/cid,
get, set, defaults, fetch, save/destroy, validate
Also be aware of useful functions like:
escape, unset, clear, parse, clone, isNew, hasChanged/changed/changedAttributes,
previous/previousAttributes
var CallItem = Backbone.Model.extend({
urlRoot:"/call"
});
var myCall = new CallItem();
mycall.save({
name: "Leia",
phone: "1-213-345-2343",
call_on: "2013-03-10"
});
COLLECTION
extend, initialize(constructor), url, model, models, add,
remove, get, reset
Supports 28 underscore methods ! (forEach, map, min, max...)
Also be aware of useful functions like:
sort, pluck, comparator, where
var CallList = Backbone.Collection.extend({
model: CallItem,
url: '/calls'
});
var myCallList = new CallList();
myCallList.fetch();
VIEW
extend, initialize(constructor), tagName, className, events,
remove, delegateEvents, undelegateEvents
var CallItemView = Backbone.View.extend({
events:{
"click .edit" : "render"
},
initialize: function(){
this.model.bind("change", this.render, this);
},
render: function(event) {
this.$el.html(this.template(this.model.attributes));
return this; // allow chaining
}
});
var myCallItemView = new CallItemView({
model: myCall,
el: "#my-call-view"
});
el, $el
ROUTER
extend, initialize(constructor), navigate, route
var CallRouter = Backbone.Router.extend({
routes: {
"help": "help", // #help
"call/:id": "call", // #call/10
"search/:date(/p:page)": "search" // #search/2013-03-10 or #sea
rch/2013-03-10/2
},
help: function() {
//...your function
}
});
$(function(){
new CallRouter();
Backbone.history.start({pushState: true});
});
PUTTING IT ALL TOGETHER
Lets look at: Call Butler
src/
js/
init.js
callButlerApp.js
routers/
models/
callItem.js
callList.js
views/
callItem.js
callDetail.js
Over 35 Javascript MVC framework libraries showcased at
Jster Catalog
FURTHER RESOURCES
AngularJS Videos at
Using Knockoutjs and JQuery to Create Richer MVC 4
Applications at 11:40am
Backbone.JS
Backbone.JS Source Code
Call Butler Source Code
Backbone Tutorials
egghead.io
Bocoup Training at $1,149!
Good Luck BackboneJS Padawan!

More Related Content

PPTX
BackboneJS Training - Giving Backbone to your applications
PPTX
Backbonejs for beginners
PPT
BackboneJs
PDF
Intro to BackboneJS + Intermediate Javascript
PDF
Understanding backbonejs
KEY
【前端Mvc】之豆瓣说实践
PDF
Backbone
ODP
BackboneJS and friends
BackboneJS Training - Giving Backbone to your applications
Backbonejs for beginners
BackboneJs
Intro to BackboneJS + Intermediate Javascript
Understanding backbonejs
【前端Mvc】之豆瓣说实践
Backbone
BackboneJS and friends

What's hot (20)

PDF
Backbone js in drupal core
PDF
In-depth changes to Drupal 8 javascript
PDF
Upgrade your javascript to drupal 8
PDF
Effective cassandra development with achilles
PDF
Backbonejs on Rails
PDF
Cassandra java libraries
PDF
Introduction to Backbone.js
PDF
Mini-Training: AngularJS
PDF
Spca2014 hillier 3rd party_javascript_libraries
PPTX
AngularJS in 60ish Minutes
PDF
Javascript MVC & Backbone Tips & Tricks
PPTX
Backbone/Marionette recap [2015]
PDF
站在angular的視角回頭看backbone - Data與Event
PDF
Intro to emberjs
PDF
Backbone to React. What it says about awesome UI Code.
PDF
Rails course day 7
PPTX
BackboneJS + ReactJS
PDF
Dependency Management with RequireJS
PPT
Backbone.js
PPT
Drupal Javascript for developers
Backbone js in drupal core
In-depth changes to Drupal 8 javascript
Upgrade your javascript to drupal 8
Effective cassandra development with achilles
Backbonejs on Rails
Cassandra java libraries
Introduction to Backbone.js
Mini-Training: AngularJS
Spca2014 hillier 3rd party_javascript_libraries
AngularJS in 60ish Minutes
Javascript MVC & Backbone Tips & Tricks
Backbone/Marionette recap [2015]
站在angular的視角回頭看backbone - Data與Event
Intro to emberjs
Backbone to React. What it says about awesome UI Code.
Rails course day 7
BackboneJS + ReactJS
Dependency Management with RequireJS
Backbone.js
Drupal Javascript for developers
Ad

Similar to Backbone js in action (20)

PPTX
Backbone the Good Parts
PDF
[2015/2016] Backbone JS
PDF
Developing maintainable Cordova applications
PDF
Backbone JS for mobile apps
PPTX
Backbone
PDF
Using Backbone.js with Drupal 7 and 8
PPT
Backbone js-slides
PDF
Backbone js
PDF
Backbone.js
PDF
Backbone.js
PPT
Backbone js
PDF
Raybiztech Guide To Backbone Javascript Library
PPTX
Backbone introduction
PPT
Backbone js
PDF
Backbone Basics with Examples
PPTX
Backbonejs
PDF
Javascript Application Architecture with Backbone.JS
PPT
Backbone introdunction
PDF
Viking academy backbone.js
PDF
Backbone.js slides
Backbone the Good Parts
[2015/2016] Backbone JS
Developing maintainable Cordova applications
Backbone JS for mobile apps
Backbone
Using Backbone.js with Drupal 7 and 8
Backbone js-slides
Backbone js
Backbone.js
Backbone.js
Backbone js
Raybiztech Guide To Backbone Javascript Library
Backbone introduction
Backbone js
Backbone Basics with Examples
Backbonejs
Javascript Application Architecture with Backbone.JS
Backbone introdunction
Viking academy backbone.js
Backbone.js slides
Ad

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
Modernizing your data center with Dell and AMD
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Modernizing your data center with Dell and AMD
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25 Week I

Backbone js in action

  • 1. BACKBONE JS IN ACTION @UshaGuduri
  • 2. AGENDA Web Apps Back Then Web Apps Now What the heck is the problem?!! What is BackboneJS? Lets get hands-on Whats out there
  • 3. ONCE UPON A TIME...
  • 5. HOW DO WE ACHIEVE DYNAMISM? “ The best thing about JavaScript is its implementation of functions. ”
  • 6. JQUERY AJAX $(function () { // do stuff after DOM has loaded }); $.ajax({ url: "/myurl", beforeSend: function ( xhr ) { xhr.overrideMimeType("text/plain;"); }, success: function(response) { // I AM INVINCIBLE! }, error: function(response) { // What, I FAILED ? :O } })
  • 7. WHAT THE HECK IS THE PROBLEM?!!! Lets check Boston.com
  • 8. “ 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. ”
  • 10. BACKBONEJS CONSTRUCTS Model (and Collection): Application (domain) data objects that are retrieved from and persisted to the server View: HTML presentation of the data stored in the models and DOM 'controller' Router: Controller that saves the state of the application via a url hash History: Global router (per frame) to handle hashchange events or pushState Events: Module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Sync: Manages actual persistence by a "function that Backbone calls every time it attempts to read or save a model to the server."
  • 12. HOW TO MAP BACKBONE TO MVC
  • 13. MODEL extend, initialize(constructor), url/urlRoot, id/idAttribute/cid, get, set, defaults, fetch, save/destroy, validate Also be aware of useful functions like: escape, unset, clear, parse, clone, isNew, hasChanged/changed/changedAttributes, previous/previousAttributes var CallItem = Backbone.Model.extend({ urlRoot:"/call" }); var myCall = new CallItem(); mycall.save({ name: "Leia", phone: "1-213-345-2343", call_on: "2013-03-10" });
  • 14. COLLECTION extend, initialize(constructor), url, model, models, add, remove, get, reset Supports 28 underscore methods ! (forEach, map, min, max...) Also be aware of useful functions like: sort, pluck, comparator, where var CallList = Backbone.Collection.extend({ model: CallItem, url: '/calls' }); var myCallList = new CallList(); myCallList.fetch();
  • 15. VIEW extend, initialize(constructor), tagName, className, events, remove, delegateEvents, undelegateEvents var CallItemView = Backbone.View.extend({ events:{ "click .edit" : "render" }, initialize: function(){ this.model.bind("change", this.render, this); }, render: function(event) { this.$el.html(this.template(this.model.attributes)); return this; // allow chaining } }); var myCallItemView = new CallItemView({ model: myCall, el: "#my-call-view" });
  • 17. ROUTER extend, initialize(constructor), navigate, route var CallRouter = Backbone.Router.extend({ routes: { "help": "help", // #help "call/:id": "call", // #call/10 "search/:date(/p:page)": "search" // #search/2013-03-10 or #sea rch/2013-03-10/2 }, help: function() { //...your function } }); $(function(){ new CallRouter(); Backbone.history.start({pushState: true}); });
  • 18. PUTTING IT ALL TOGETHER Lets look at: Call Butler src/ js/ init.js callButlerApp.js routers/ models/ callItem.js callList.js views/ callItem.js callDetail.js
  • 19. Over 35 Javascript MVC framework libraries showcased at Jster Catalog
  • 20. FURTHER RESOURCES AngularJS Videos at Using Knockoutjs and JQuery to Create Richer MVC 4 Applications at 11:40am Backbone.JS Backbone.JS Source Code Call Butler Source Code Backbone Tutorials egghead.io Bocoup Training at $1,149!