What Does Backbone.js Mean?
Backbone.js is a model view controller (MVC) Web application framework that provides structure to JavaScript-heavy applications. This is done by supplying models with custom events and key-value binding, views using declarative event handling and collections with a rich application programming interface (API). All of these features are connected to the prevailing application using a RESTful JSON interface.
Backbone can be defined as an exceptionally lightweight library, which allows the creation of easy-to-maintain front ends for applications. It is back-end agnostic and operates very well with existing modern JavaScript libraries. This lightweight library is extremely useful in simplifying the procedure for developing interactive, complex and data-driven applications. Backbone.js offers a neat solution to separate data from presentation by structuring the code and splitting it into semantically meaningful .js files.
Techopedia Explains Backbone.js
The annotated source code of Backbone.js is available on GitHub. Also available are a sample application, an online test suite, a number of tutorials and a large list of real-world projects that use the Backbone technology.
The core of Backbone.js includes four major classes:
- Model: Models are the core part of all JavaScript applications. Models contain interactive data in addition to the substantial element of logic surrounding the data, such as validations, conversions, access control and computed properties. Backbone.Model can be extended with domain-specific methods, and the model offers a standard functionality set to manage the changes. In Backbone.js, the model symbolizes a single entity.
- Collection: Collections in Backbone.js are basically an array of models. Collections are usually a query result in which the results include a number of models.
- View: A view in Backbone.js listens to the events thrown by the Document Object Model and collections/models. In addition, it represents the state and data model of the application to the user.
- Controller: Controllers in Backbone can be used to create stateful, bookmarkable applications with the help of hashbangs.
When the state or content of a model is modified, other objects subscribed to the model are notified to proceed accordingly. The views listen to the model changes and then automatically update themselves in accordance with the changes.
Some applications that use Backbone.js include:
- DocumentCloud
- LinkedIn Mobile
- AudioVroom
- Foursquare
- Basecamp Mobile
- Diaspora
- Pandora
- Animoto