concept backbone in category javascript

appears as: Backbone
JavaScript Application Design: A Build First Approach

This is an excerpt from Manning's book JavaScript Application Design: A Build First Approach.

Chapter 7 is dedicated to patterns and practices, such as how to best develop code, whether jQuery is the right choice for you, and how to write JavaScript code you can use in both the client and the server. We’ll then look at the Backbone MVC framework. Keep in mind that Backbone is the tool I’ll use to introduce you to MVC in JavaScript, but it’s by no means the only tool you can use to this end.

Many different frameworks and libraries exist for performing client-side MVC, let alone server-side MVC, and sadly I can’t cover all of them. One of the hardest choices I had to make for this book was picking an MVC framework to use. For a long while, I was torn between React, Backbone, and Angular. Ultimately, I decided Backbone is the best tool for teaching the concepts I want to relay to you. Arriving at that choice wasn’t easy, and it came down mostly to maturity, simplicity, and familiarity. Backbone is one of the oldest MVC libraries out there, and therefore one of the most mature. It’s also one of the most popular MVC libraries. Angular is an MVC framework developed at Google. It’s also mature—in fact it was released before Backbone—but it’s also much more complex, having a steep learning curve. React is Facebook’s take; it’s not as complex as Angular, but it’s a much younger project, having been initially released in 2013, and it doesn’t provide true MVC capabilities as it’s meant to provide only the View in MVC.

Backbone needs a DOM manipulation library such as jQuery or Zepto to function properly. You’ll use jQuery in your examples, because it’s more widely known. I recommend you look at Zepto if you’re considering this setup for a production-grade application, as it has a significantly smaller footprint. Let’s go ahead and install jQuery as well: