What is Backbone JS?Backbone.js
PROVIDES STRUCTURE TO WEB APPLICATIONS
BackboneJS provides structure to web app via giving models with key-value bindings as well as custom events, collections that have rich API of countless functions, views that have declarative event handling and connects all to the existing API over a RESTful JSON interface.
WHEN TO USE BACKBONEJS
FEATURES OF BACKBONEJS
2. It provides different building blocks, like views, models, events, routers and collections to assemble client side web apps.
3. It is a simple library for differentiating business and UI logic.
4. It updates automatically the HTML of an app when model changes.
5. The free and open source library has more than 100 extensions available.
6. It manages data model that includes user data and display the data at the server side with the same format that’s written at client side.
7. Acts as a backbone for a project and helps in organizing code.
8. It enables creating client side web apps or mobile apps in an organized and well-structured format.
9. Has soft dependency with jQuery and a hard dependency with Underscore.js.
THREE MAJOR ADVANTAGES OF BACKBONEJS
SYNCING WITH A BACK-END
The BackboneJS models could be tied to a back-end easily. Out-of-the-box, it provides great support to RESTful APIs in a way that models could map to a RESTful endpoint. If the API is correctly designed, backbone is configured already to directly access these for read, write and delete operations, through GET, POST and DELETE. If using a backend other than a RESTful API, it is still flexible enough to accommodate that.
It’s easy to build small and slick web apps with frameworks such as jQuery. However, when a project grows, jQuery callbacks and declarations become more and more complex and distributed all over the place. Furthermore, the code gets more cluttered and difficult to read. BackboneJS alleviates this via offering an event-driven communication between models and views. One could attach event listeners to any model attributed, which provides a much nuanced controller over what is changed in the view. The events of BackboneJS build on top of regular DOM events, making the mechanism very extensible and versatile. With one code line, for instance one could introduce a publish/subscribe pattern which ties all the views together.
MAINTAINABILITY THROUGH FOLLOWING CONVENTIONS
Conventions are great for introducing a common coding style with no need for an extensive set of coding standards. BackboneJS is particularly helpful in maintaining a clean code based regardless of having multiple people coordinating on a code.
WHY YOU NEED BACKBONEJS
BackboneJS is an MVC framework that encourages one to abstract data into models. It provides structure to web applications.