Backbone.js Introduction and Resources
The library is designed with the Model-View-Presenter (MVP) programming architecture, a popular software design pattern for user interfaces. However, in the Backbone.js ecosystem, the terminology "models, views, and collections" is used.
Models, Views, and Collections
The philosophy behind Backbone.js is that application logic and the presentation of application data should be separated. This separation is maintained in the way that models and views are created and manipulated.
In Backbone.js, a model represents a single table of data along with the functions and logic needed to manipulate the data. The data is presented using one or more views, which are simply portions of a web application UI that translate the data in the model and adjust the webpage DOM to match. Views also listen for user input and send that input back to the appropriate model to update the data held in the model.
Backbone.js includes a built-in JSON API. When a model is changed, the change can be communicated back to a web server database over the JSON API. Since virtually all server-side programming languages can be equipped to send and receive JSON data, virtually any server-side language or application with a JSON API can be used to communicate data to and from a Backbone.js web application and update the application database accordingly.
Related models can be organized and managed by grouping them together into collections, which offer the added benefit of providing a single listening point whereby multiple views can be used to keep one or more views continuously updated.
What is Backbone.js Good For?
For example, the Backbone.js website provides a list of known projects built with Backbone.js which includes a veritable who's-who of well-known internet startups and established digital titans such as:
- Khan Academy
- Walmart Mobile
- Code School
- And many more.
On the other hand, this does mean that more foundational groundwork must be laid when building a web application with Backbone.js than with a framework such as AngularJS that includes a pre-build foundational groundwork.
In addition, you'll want to get up to speed with Underscore.js, or it's descendant library, Lodash. Backbone.js requires that one of these two libraries be loaded prior to loading Backbone.js, so having a degree of familiarity with one or the other will come in handy.
If you want to get up and running with Backbone.js as quickly as possible, then tackling a few of the following tutorials is your best bet. We've sorted them in order of complexity. So, if you're a beginner, start with one of the first resources listed as the latter resources assume quite a bit of prior knowledge.
- Backbone.js Getting Started
- Backbone.js for Absolute Beginners by Adrian Mejia
- Backbone, The Primer
- Building a Single Page App with Backbone.js, Underscore.js, and jQuery by Henrik Joreteg
- Backbone Contact Manager Tutorial
- Backbone Mobile App Example
The Backbone.js GitHub repository also includes an extensive list of additional tutorials, blog posts, and examples of Backbone.js web applications.
If you really want to master Backbone.js, or if you just prefer your education to be printed and bound, consider the following positively-reviewed texts.
- Mastering Backbone.js (2016) by Abiee Echamea
- Backbone.js Patterns and Best Practices (2014) by Swarnendu De
- Backbone.js Blueprints (2014) by Andrew Burgess.
Further Reading and Resources
We have more guides, tutorials, and infographics related to coding and website development:
- XML Resources: once thought to be the replacement for HTML, it is still a very popular data storage and transfer language.
- PHP Introduction and Resources: the most popular server-side programming language in the world — and for a reason.
- ASP.NET Resources: this guide will get you going with Microsoft's .NET framework for creating webpages.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn? It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"