SlideShare a Scribd company logo
April
                                                   18
                                                   2012




MVC           Mohammed Arif
              Manager Interactive Development @ SapientNitro

    &         www.mohammedarif.com
              https://twitter.com/#!/arif_iq
backbone.js   http://in.linkedin.com/in/mohdarif
Agenda
•   What is MVC

•   Why MVC

•   MVC Advantages

•   What is backbone

•   Why backbone

•   What is JavaScript templating

•   Why JavaScript templating

•   Questions/Feedback
What is MVC…



MVC stands for Model-View-Controller.
What is MVC…



MVC is a Architectural Design Pattern
What is MVC…



Separates a web application into three parts: the data
(Model), the presentation of that data to the user (View),
and the actions taken on any user interaction
(Controller or routers).
What is MVC

In the past it has been heavily used for structuring desktop and server-side
applications, but it's only been in recent years that come to being applied to
JavaScript.


As the majority of JavaScript developers currently using these patterns opt to
utilize libraries such as Backbone.js for implementing an MVC/MV*-like
structure.
Design Pattern
A pattern that has been developed to help programmers cope with common
problems


Blueprints on how to construct something
MVC - Model

Data representation


Can be database/xml/etc


Business Logic
MVC - View

Data presentation and user input


Renders the Model in to a View


Can be HTML/PDF/WML/Javascript


No computations, very little logic, display logic i.e. loops
MVC - Controller

Dispatches Requests and controls flow


Centralizes access


Interacts with Model and View
Why MVC

If you do a lot of JavaScript, things tend to get messy!


Backbone provides a way to organize your code, by using the MVC pattern


Only the View accesses the DOM (e.g. with jQuery, Dojo,…)
MVC Advantages…

Separation of interests
    Model centralizes business logic
    View centralizes display logic
    Controller centralizes application flow
MVC Advantages

Clean separation of content/style


Improved decoupling


Easier testing


Allow multiple people to work on different parts
What is backbone.js

Backbone.js is one of a number of JavaScript frameworks for creating MVC-
like web applications, it's relatively lightweight and can be easily tested using
third-party toolkits such as Jasmine or QUnit.



                                     Or
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.
Why backbone

Organize the structure to your application


Simplify server-side persistence


Decouple the DOM from your page's data


Model data, views and routers in a succinct manner


Provide DOM, model and collection synchronization
Backbone.js - Model


Models are the heart of any JavaScript application, containing the interactive
data as well as a large part of the logic surrounding it: conversions,
validations, computed properties, and access control.
Backbone.js - Model

/*Let’s create a model*/
Person = Backbone.Model.extend({
         initialize: function(){
                  alert("Hello Studio");
         }
});


var person = new Person;
/*initialize() is triggered whenever you create a new instance of a model*/
Backbone.js - View


Backbone views are used to reflect what your applications’ data models look
like


They are also used to listen to events and react accordingly
Backbone.js - View

SearchView = Backbone.View.extend({
   initialize: function(){
       alert("Alerts suck.");
   }
 });


 // The initialize function is always called when instantiating a Backbone View.
 // Consider it the constructor of the class.
 var search_view = new SearchView;
Backbone.js - Collection

 Backbone collections are simply an ordered set of models.


var Song = Backbone.Model.extend({
   initialize: function(){
       console.log("Music is the answer");
   }
 });
 var Album = Backbone.Collection.extend({
                  model: Song
         });
What is JavaScript templating

A template contains markup with binding expressions. The template is
applied to data objects or arrays, and rendered into the HTML DOM.
Why JavaScript templating

Loading all data from the server especially in rich list displays


Adding or updating new items in lists


Anywhere you need to add new complex content to the page


Anything that requires client side HTML rendering
MVC & backbone.js

More Related Content

What's hot (20)

PPTX
Mvc 4 0_jayant_jindal_28082010
Rishu Mehra
 
PPTX
Mvc framework
Dhurham Fahem
 
PPTX
ASP.NET MVC Presentation
Volkan Uzun
 
PPTX
Introduction to ASP.NET MVC
Emad Alashi
 
PDF
ASP.NET MVC 4 Introduction
Lohith Goudagere Nagaraj
 
PPTX
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
PPTX
Mvc fundamental
Nguyễn Thành Phát
 
PPT
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
PPT
CTTDNUG ASP.NET MVC
Barry Gervin
 
PPTX
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
PPTX
Asp.net mvc presentation by Nitin Sawant
Nitin S
 
PPTX
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
PPTX
Introduction to mvc architecture
ravindraquicsolv
 
PDF
Webforms or MVC
Aslam Siddiqui
 
PPT
MSDN - ASP.NET MVC
Maarten Balliauw
 
ODP
What is MVC?
Dom Cimafranca
 
PPTX
ASP.NET MVC for Begineers
Shravan Kumar Kasagoni
 
PPT
ASP.NET MVC Presentation
ivpol
 
PDF
ASP.Net MVC ile Web Uygulamaları - 4(Model)
İbrahim ATAY
 
Mvc 4 0_jayant_jindal_28082010
Rishu Mehra
 
Mvc framework
Dhurham Fahem
 
ASP.NET MVC Presentation
Volkan Uzun
 
Introduction to ASP.NET MVC
Emad Alashi
 
ASP.NET MVC 4 Introduction
Lohith Goudagere Nagaraj
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
Mvc fundamental
Nguyễn Thành Phát
 
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
CTTDNUG ASP.NET MVC
Barry Gervin
 
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Asp.net mvc presentation by Nitin Sawant
Nitin S
 
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 
Introduction to mvc architecture
ravindraquicsolv
 
Webforms or MVC
Aslam Siddiqui
 
MSDN - ASP.NET MVC
Maarten Balliauw
 
What is MVC?
Dom Cimafranca
 
ASP.NET MVC for Begineers
Shravan Kumar Kasagoni
 
ASP.NET MVC Presentation
ivpol
 
ASP.Net MVC ile Web Uygulamaları - 4(Model)
İbrahim ATAY
 

Viewers also liked (20)

PDF
Intro to Backbone.js by Azat Mardanov for General Assembly
Azat Mardanov
 
PDF
Introduction to Backbone.js
Jonathan Weiss
 
PDF
Introduction to Backbone.js
Roman Kalyakin
 
PDF
Introduction à Marionette
Raphaël Lemaire
 
PPT
Backbone.js
Knoldus Inc.
 
PDF
AngularJS vs. Ember.js vs. Backbone.js
Mark
 
PPTX
Backbone And Marionette : Take Over The World
harshit040591
 
KEY
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Mikko Ohtamaa
 
PPTX
Backbone/Marionette recap [2015]
Andrii Lundiak
 
PDF
Introduction to Marionette Collective
Puppet
 
PPTX
Introduction to Backbone.js & Marionette.js
Return on Intelligence
 
DOCX
Makalah analisis industri dan persaingan
Septian Muna Barakati
 
PPTX
Marionette talk 2016
Kseniya Redunova
 
PDF
Client-side MVC with Backbone.js
iloveigloo
 
PDF
introduction to Marionette.js (jscafe14)
Ryuma Tsukano
 
PPTX
Backbone.js
VO Tho
 
PDF
Marionette: the Backbone framework
frontendne
 
PDF
RequireJS
Sebastiano Armeli
 
PPTX
Introduction to Backbone.js
Pragnesh Vaghela
 
PPSX
RequireJS
Tim Doherty
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Azat Mardanov
 
Introduction to Backbone.js
Jonathan Weiss
 
Introduction to Backbone.js
Roman Kalyakin
 
Introduction à Marionette
Raphaël Lemaire
 
Backbone.js
Knoldus Inc.
 
AngularJS vs. Ember.js vs. Backbone.js
Mark
 
Backbone And Marionette : Take Over The World
harshit040591
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Mikko Ohtamaa
 
Backbone/Marionette recap [2015]
Andrii Lundiak
 
Introduction to Marionette Collective
Puppet
 
Introduction to Backbone.js & Marionette.js
Return on Intelligence
 
Makalah analisis industri dan persaingan
Septian Muna Barakati
 
Marionette talk 2016
Kseniya Redunova
 
Client-side MVC with Backbone.js
iloveigloo
 
introduction to Marionette.js (jscafe14)
Ryuma Tsukano
 
Backbone.js
VO Tho
 
Marionette: the Backbone framework
frontendne
 
Introduction to Backbone.js
Pragnesh Vaghela
 
RequireJS
Tim Doherty
 
Ad

Similar to MVC & backbone.js (20)

PPTX
Mvc Brief Overview
rainynovember12
 
PPT
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
PPTX
MV* presentation frameworks in Javascript: en garde, pret, allez!
Roberto Messora
 
PPTX
Spring tutorials
TIB Academy
 
PPS
Introduction To Mvc
Volkan Uzun
 
PDF
Getting Started with Spring Framework
Edureka!
 
PPTX
Asp.netmvc handson
Prashant Kumar
 
PPTX
An overview of microsoft mvc dot net
neha sharma
 
DOCX
Month 2 report
PRIYANKA FNU
 
PPT
MVC
akshin
 
PDF
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
PPTX
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
PDF
Principles of MVC for Rails Developers
Edureka!
 
PPTX
Fundaments of Knockout js
Flavius-Radu Demian
 
PDF
Jinal desai .net
rohitkumar1987in
 
PPTX
MVC Framework
Ashton Feller
 
PPT
Asp.net mvc
Taranjeet Singh
 
PPTX
ASP.NET Presentation
Rasel Khan
 
PPTX
Programming is Fun with ASP.NET MVC
Ian Carnaghan
 
PDF
MVC in PHP
Vineet Kumar Saini
 
Mvc Brief Overview
rainynovember12
 
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
Roberto Messora
 
Spring tutorials
TIB Academy
 
Introduction To Mvc
Volkan Uzun
 
Getting Started with Spring Framework
Edureka!
 
Asp.netmvc handson
Prashant Kumar
 
An overview of microsoft mvc dot net
neha sharma
 
Month 2 report
PRIYANKA FNU
 
MVC
akshin
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
Principles of MVC for Rails Developers
Edureka!
 
Fundaments of Knockout js
Flavius-Radu Demian
 
Jinal desai .net
rohitkumar1987in
 
MVC Framework
Ashton Feller
 
Asp.net mvc
Taranjeet Singh
 
ASP.NET Presentation
Rasel Khan
 
Programming is Fun with ASP.NET MVC
Ian Carnaghan
 
MVC in PHP
Vineet Kumar Saini
 
Ad

More from Mohammed Arif (6)

PPTX
Yeoman
Mohammed Arif
 
PPTX
Grunt - The JavaScript Task Runner
Mohammed Arif
 
PPT
Thalassemia
Mohammed Arif
 
PPT
HTML5 ★ Boilerplate
Mohammed Arif
 
PPT
jQuery
Mohammed Arif
 
PPT
JavaScript & Dom Manipulation
Mohammed Arif
 
Grunt - The JavaScript Task Runner
Mohammed Arif
 
Thalassemia
Mohammed Arif
 
HTML5 ★ Boilerplate
Mohammed Arif
 
JavaScript & Dom Manipulation
Mohammed Arif
 

Recently uploaded (20)

PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 

MVC & backbone.js

  • 1. April 18 2012 MVC Mohammed Arif Manager Interactive Development @ SapientNitro & www.mohammedarif.com https://twitter.com/#!/arif_iq backbone.js http://in.linkedin.com/in/mohdarif
  • 2. Agenda • What is MVC • Why MVC • MVC Advantages • What is backbone • Why backbone • What is JavaScript templating • Why JavaScript templating • Questions/Feedback
  • 3. What is MVC… MVC stands for Model-View-Controller.
  • 4. What is MVC… MVC is a Architectural Design Pattern
  • 5. What is MVC… Separates a web application into three parts: the data (Model), the presentation of that data to the user (View), and the actions taken on any user interaction (Controller or routers).
  • 6. What is MVC In the past it has been heavily used for structuring desktop and server-side applications, but it's only been in recent years that come to being applied to JavaScript. As the majority of JavaScript developers currently using these patterns opt to utilize libraries such as Backbone.js for implementing an MVC/MV*-like structure.
  • 7. Design Pattern A pattern that has been developed to help programmers cope with common problems Blueprints on how to construct something
  • 8. MVC - Model Data representation Can be database/xml/etc Business Logic
  • 9. MVC - View Data presentation and user input Renders the Model in to a View Can be HTML/PDF/WML/Javascript No computations, very little logic, display logic i.e. loops
  • 10. MVC - Controller Dispatches Requests and controls flow Centralizes access Interacts with Model and View
  • 11. Why MVC If you do a lot of JavaScript, things tend to get messy! Backbone provides a way to organize your code, by using the MVC pattern Only the View accesses the DOM (e.g. with jQuery, Dojo,…)
  • 12. MVC Advantages… Separation of interests Model centralizes business logic View centralizes display logic Controller centralizes application flow
  • 13. MVC Advantages Clean separation of content/style Improved decoupling Easier testing Allow multiple people to work on different parts
  • 14. What is backbone.js Backbone.js is one of a number of JavaScript frameworks for creating MVC- like web applications, it's relatively lightweight and can be easily tested using third-party toolkits such as Jasmine or QUnit. Or 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.
  • 15. Why backbone Organize the structure to your application Simplify server-side persistence Decouple the DOM from your page's data Model data, views and routers in a succinct manner Provide DOM, model and collection synchronization
  • 16. Backbone.js - Model Models are the heart of any JavaScript application, containing the interactive data as well as a large part of the logic surrounding it: conversions, validations, computed properties, and access control.
  • 17. Backbone.js - Model /*Let’s create a model*/ Person = Backbone.Model.extend({ initialize: function(){ alert("Hello Studio"); } }); var person = new Person; /*initialize() is triggered whenever you create a new instance of a model*/
  • 18. Backbone.js - View Backbone views are used to reflect what your applications’ data models look like They are also used to listen to events and react accordingly
  • 19. Backbone.js - View SearchView = Backbone.View.extend({ initialize: function(){ alert("Alerts suck."); } }); // The initialize function is always called when instantiating a Backbone View. // Consider it the constructor of the class. var search_view = new SearchView;
  • 20. Backbone.js - Collection Backbone collections are simply an ordered set of models. var Song = Backbone.Model.extend({ initialize: function(){ console.log("Music is the answer"); } }); var Album = Backbone.Collection.extend({ model: Song });
  • 21. What is JavaScript templating A template contains markup with binding expressions. The template is applied to data objects or arrays, and rendered into the HTML DOM.
  • 22. Why JavaScript templating Loading all data from the server especially in rich list displays Adding or updating new items in lists Anywhere you need to add new complex content to the page Anything that requires client side HTML rendering