SlideShare uma empresa Scribd logo
1 de 23
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

Mais conteúdo relacionado

Mais procurados

Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Rishu Mehra
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCEmad Alashi
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017Innovation Studio
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperNyros Technologies
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines Dev Raj Gautam
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantNitin Sawant
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)Hatem Hamad
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architectureravindraquicsolv
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
 
ASP.Net MVC ile Web Uygulamaları - 4(Model)
ASP.Net MVC ile Web Uygulamaları - 4(Model)ASP.Net MVC ile Web Uygulamaları - 4(Model)
ASP.Net MVC ile Web Uygulamaları - 4(Model)İbrahim ATAY
 

Mais procurados (20)

Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Mvc framework
Mvc frameworkMvc framework
Mvc framework
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
ASP.NET MVC 4 Introduction
ASP.NET MVC 4 IntroductionASP.NET MVC 4 Introduction
ASP.NET MVC 4 Introduction
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
 
Webforms or MVC
Webforms or MVCWebforms or MVC
Webforms or MVC
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
What is MVC?
What is MVC?What is MVC?
What is MVC?
 
ASP.NET MVC for Begineers
ASP.NET MVC for BegineersASP.NET MVC for Begineers
ASP.NET MVC for Begineers
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
ASP.Net MVC ile Web Uygulamaları - 4(Model)
ASP.Net MVC ile Web Uygulamaları - 4(Model)ASP.Net MVC ile Web Uygulamaları - 4(Model)
ASP.Net MVC ile Web Uygulamaları - 4(Model)
 

Destaque

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
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à MarionetteRaphaël Lemaire
 
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
 
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
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...Mikko Ohtamaa
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Andrii Lundiak
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette CollectivePuppet
 
Backbone/Marionette introduction
Backbone/Marionette introductionBackbone/Marionette introduction
Backbone/Marionette introductionmatt-briggs
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsReturn on Intelligence
 
Makalah analisis industri dan persaingan
Makalah analisis industri dan persainganMakalah analisis industri dan persaingan
Makalah analisis industri dan persainganSeptian Muna Barakati
 
Client-side MVC with Backbone.js
Client-side MVC with Backbone.js Client-side MVC with Backbone.js
Client-side MVC with Backbone.js iloveigloo
 
introduction to Marionette.js (jscafe14)
introduction to Marionette.js (jscafe14)introduction to Marionette.js (jscafe14)
introduction to Marionette.js (jscafe14)Ryuma Tsukano
 
Backbone.js
Backbone.jsBackbone.js
Backbone.jsVO Tho
 
Marionette: the Backbone framework
Marionette: the Backbone frameworkMarionette: the Backbone framework
Marionette: the Backbone frameworkfrontendne
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.jsPragnesh Vaghela
 

Destaque (20)

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
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à Marionette
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
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
 
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
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
 
Backbone/Marionette introduction
Backbone/Marionette introductionBackbone/Marionette introduction
Backbone/Marionette introduction
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
 
Makalah analisis industri dan persaingan
Makalah analisis industri dan persainganMakalah analisis industri dan persaingan
Makalah analisis industri dan persaingan
 
Marionette talk 2016
Marionette talk 2016Marionette talk 2016
Marionette talk 2016
 
Client-side MVC with Backbone.js
Client-side MVC with Backbone.js Client-side MVC with Backbone.js
Client-side MVC with Backbone.js
 
introduction to Marionette.js (jscafe14)
introduction to Marionette.js (jscafe14)introduction to Marionette.js (jscafe14)
introduction to Marionette.js (jscafe14)
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Marionette: the Backbone framework
Marionette: the Backbone frameworkMarionette: the Backbone framework
Marionette: the Backbone framework
 
RequireJS
RequireJSRequireJS
RequireJS
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 

Semelhante a MVC & backbone.js

MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!Roberto Messora
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorialsTIB Academy
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring FrameworkEdureka!
 
An overview of microsoft mvc dot net
An overview of microsoft mvc dot netAn overview of microsoft mvc dot net
An overview of microsoft mvc dot netneha sharma
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S GuideAlicia Buske
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9AHM Pervej Kabir
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails DevelopersEdureka!
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCIan Carnaghan
 

Semelhante a MVC & backbone.js (20)

Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring Framework
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
 
An overview of microsoft mvc dot net
An overview of microsoft mvc dot netAn overview of microsoft mvc dot net
An overview of microsoft mvc dot net
 
Month 2 report
Month 2 reportMonth 2 report
Month 2 report
 
MVC
MVCMVC
MVC
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
Fundaments of Knockout js
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
 
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVC
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
 

Mais de Mohammed Arif

Mais de Mohammed Arif (6)

Yeoman
YeomanYeoman
Yeoman
 
Grunt - The JavaScript Task Runner
Grunt - The JavaScript Task RunnerGrunt - The JavaScript Task Runner
Grunt - The JavaScript Task Runner
 
Thalassemia
ThalassemiaThalassemia
Thalassemia
 
HTML5 ★ Boilerplate
HTML5 ★ BoilerplateHTML5 ★ Boilerplate
HTML5 ★ Boilerplate
 
jQuery
jQueryjQuery
jQuery
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 

Último

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Último (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

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