My current project at work is a large scale Backbone application. The company had no prior experience in web programming before this project and was mainly used to programming in Java. So in order to staff up the project, we needed some way of converting our Java programmers into Backbone programmers.
To do this we looked at the various training materials available on the web. There are a number of excellent resources out there, such as Addy Osmani's book, the MVC Todo app and the Backbone docs themselves. We wanted to develop a selection of documentation/training materials that we could hand to a new member of the team to get them up to speed.
One of the newer books that we've looked at is Beginning Backbone by James Sugrue. Disclosure: I've previously worked on the same team as James for two years at my current company.
The book begins with a good introduction and overview of Backbone from an architectural point of view and gives examples of companies who have built products on Backbone. I liked this approach, as it's one thing explaining why you should use Backbone from a coding perspective but it's also nice to be able to justify the choice from a risk perspective to management. Having concrete examples of successful companies helps us make that case.
Each of the components of Backbone is dealt with comprehensively. The models, collections, views, events and router are explained with plenty of examples. Templating described alongside the views using both Handlebars and Mustache.
After the introduction we get a walkthrough of how to create an application. The application is surprisingly comprehensive. It's a Twitter clone and not the standard todo app. It deals with linking models to views, reusing views, and how to tie it together with events.
From there the book branches out to cover the wider Backbone ecosystem. Backbone is not an all encompassing framework. In fact it quite a simple framework with a lot of scope for customisation. It is a foundation upon which you will layer many plugins and libraries, and so understanding what additional addons are available and how to use them is vital to getting the most out of Backbone.
The book covers
We had started coding well before the book was written and a lot of the choices we had made on Backbone plugins are mentioned in the book. It was nice to get some validation of those choices. In addition reading this section of the book prompted us to look at introducing view models to our code.
One of the problems we had was that it's easy to see how a simple todo application can be built from Backbone, but it's harder to extrapolate from there and design how a larger application should hang together. We encountered problems at scale e.g. managing views and their resources when having high double digit numbers of views and templates. The book introduces two plugins - Marionette and Thorax - which extend Backbone to give more comprehensive view management. Even if the specific plugins described in the book are not for you, at least you will be made aware of the issues that await in the future.
The formatting of the code samples is off in quite a few places. The indentation is out and there are some spaces missing turning
var myarray into
varmyarray. These are more than just code formatting errors - these would lead to compile errors in the code. There is a Github repository of the code samples in the book though, which partially makes up for this.
→ posted on October 2, 2014