Backbone.js is used for providing structure to web applications. It uses simple web services like REST and JSON, thus providing lightweight and smooth interface. It offers a flexible and scalable MVC (Model-View-Control) structure for developing JavaScript application.
A web application might involve a lot of JavaScript. The main hardship we face is, inorder to provide robust and user interactive experience, ending up with a chaotic pile of jQury and JavaScript code. For a rich user-friendly application, structured programming is needed.
With Backbone, data is represented as Models, which can be created, validated, destroyed, and saved to the server. Whenever a UI action causes an attribute of a model to change, the model triggers a “change” event; all the Views that display the model’s state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information. In a finished Backbone app, we don’t have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.
Basically, Backbone is an attempt to discover the minimal set of data-structuring (models and collections) and user interface (views and URLs) primitives that are generally useful when building web applications with JavaScript. In an ecosystem where overarching, decides-everything-for-you frameworks are commonplace, and many libraries require a site to be reorganized to suit their look, feel, and default behavior — Backbone should continue to be a tool that gives freedom to design the full experience of any web application.
It’s easy to create small and slick web applications with frameworks like jQuery. When a project grows, however, the jQuery declarations and callbacks get more and more complex and are distributed all over the place. The code becomes more and more cluttered and hard to read.

Backbone.js alleviates this by providing an event-driven communication between views and models (and other elements which we ignore for now for the sake of simplicity). One can attach event listeners to any attribute of a model, which gives control over change in the view.

The backbone.js events build on top of regular DOM events, which make the mechanism very versatile and extensible.
Backbone.js is a popular open source JavaScript framework that allows us to develop single page web application. It offers a MVC framework for organizing Javascript application.

3 major advantages:

1. When a project grows, the jQuery declarations and callbacks gets more complex. The code becomes more cluttered. Backbone.js overcomes this problem by providing an event-driven communication between views and models.

2. Backbone.js is client-side MVC architecture. It is a design pattern where we separate the data from the way it is defined, manipulated and displayed. It allows us to structure our Javascript code in an MVC pattern.

3. In the MVC platform, web application depends upon server for getting json data for the logic on how to display it. Here load on server is reduced and it helps in increasing the speed of the website.

Backbone also offers a “sync” utility that can persist the model back to the server (provided server is RESTful). For example, this can work quite nicely with a standard Rails CRUD app.

Another advantage of using any framework is maintainability. Bringing on other devices becomes easier, because they can follow the pattern and, thus, follow our code.

Backbone allows to clearly and modularly organizing JavaScript into highly reusable views, models, etc., it tends to foster more elegant solutions.

Most JavaScripters have dealt with the pain of writing an absurd bit of code that they knew deep down shouldn’t be where it is, and yet, for lack of a better idea, they leave it there. Then comes the frustration on binding events to the spaghetti code mess made and wrangling the DOM at the same time.

Backbone’s structure is both clear and flexible, avoiding rigid guidelines, while at the same time providing sensible places for each part of application to live. Combine this with the beautiful event system that ties it all together and a straightforward way to deal with the DOM on a per view level, and we’ve got a JavaScript dream come true.


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>