Chapter 1 ■ an IntroduCtIon to BaCkBone.js
15
• Rich documentation and a large user community: Using any new technology can be daunting,
but a mature documentation set and a large community base can help take the sting out
of this. With Backbone you get this in abundance. The documentation available at
http://backbonejs.org is simple to follow, with annotated source code and examples
that help you understand every aspect of the library. Pair this with the numerous blogs and
tutorials that you will find across the Internet and you know that you’re not alone. There are a
huge number of plug-ins and extensions available for Backbone that have been created by the
user community. It’s likely that if you encounter an issue, someone has already found a way to
resolve it. We’ll take a closer look at Backbone plug-ins and extensions later in this book.
• It scales well, and credible companies are using it: In the previous section we saw just a few
big-name companies that use Backbone. But if you go to http://backbonejs.org, you will
see that there are a huge list of companies that have adopted Backbone. The library is not just
being used for experimental projects; in the case of Airbnb, Backbone proved to be such a
good solution that it is now using it on the server side. This proves that it’s a library that scales
well and that it can integrate well with any other JavaScript library, even Node.js. The maturity
of the library counts for a lot, and because Backbone has been around for almost three years
and has reached version 1.0.0, it has the edge on a lot of other MV* solutions.
• Your code base is a jQuery mess: Backbone isn’t just for fresh projects. It’s likely that you have
some legacy applications that could use some cleanup. You may have been using jQuery
extensively, manipulating the DOM manually and making $.ajax calls. If this is the case,
Backbone can be the perfect replacement, with the Backbone.Model object enabling you
to use simpler code to achieve the same results. Don’t forget that you don’t need to use
absolutely everything that Backbone provides. You can pick and choose what suits your
application at the time.
Three Reasons Backbone Might Not Be Right for You
In some cases using Backbone might not make sense for your application. Using the wrong library for any project can
have devastating consequences. This list shows when Backbone is not such a good idea:
• Proof-of-concept applications: Sometimes you just want to get a quick experiment together
to prove what a particular user interface could look like. If you’re creating something really
simple, it’s likely that Backbone would be too much and that you might get something
together faster by using something like AngularJS. If you’re not already up to speed with how
Backbone works, some other solutions bring you from zero to app in less time. However, if the
proof of concept turns into a real application, it is worth considering Backbone for the real
implementation.
• You’re not comfortable with lower-level JavaScript: As one of the less opinionated MV*
solutions, Backbone leaves a lot of work for the developer to do. The two-way data binding
between model and view is one of these tasks. While a lot of the development community
is happy to write the code for this binding, some may find it a daunting. More opinionated
frameworks that give more guidance into the implementation details of the entire application
can be useful, but beware of potential performance issues.
• You are creating a small web page: Backbone is suitable for developers who are creating web
applications, not just trivial web pages. There is no doubt that Backbone would be overkill for
something that simple.