Loading...
X

MVC & backbone.js

I recently talked about (JavaScript) MVC (not JavaScriptMVC framework itself) in detail at work.

If some of you are really interested about the Architectural Design Pattern then MVC is the way to go to separate the web application into multiple parts.

In the past MVC 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.

So why do you need MVC at first place?
  • 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:
  • 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.

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

You can find some more detail on the same page in the slides shown below.

One observation on “MVC & backbone.js

Leave Your Observation

Your email address will not be published. Required fields are marked *