As the saying goes, judging a book by its cover is a dangerous business. A lot of books have titles that promise great things, and content that under-delivers and disappoints. Every once in a while, though, you find a gem that does the opposite. Building Backbone Plugins sounds like a niche book for library developers. But it actually is the best resource on Backbone.JS development I've found, a book that will benefit anyone who works with Backbone.
So what's the fuss about? The book's author, Derick Bailey, is the creator of Marionette.JS, a popular application framework for Backbone Apps. Building Backbone Plugins explores the problems that Derick tried to solve with Marionette and then explains the mindset behind Marionette's solutions. It is not a book exclusively about Marionette though. The solutions in the book are example code that represents a simplified view of what Marionette does. Instead the book looks at the common problems any developer will encounter in a Backbone project, and provides a possible solution, while working hard to generalize the lessons and concepts as much as possible.
Building Backbone Plugins is divided into 4 parts. The first two look at Backbone Views and dealing with the DOM. The third looks at Models and Collections. The last part deals with application structure and events. These are followed by a series of appendices that read as stretched-out blog posts on a variety of related topics that didn't quite fit into one of the 4 buckets that the rest of the book falls into.
In my mind, the first two parts are the heart of the book. They're a step-by-step look at how you can remove repetitive code from your Backbone Views and structure your application to expose the developers intent in each file, rather than burying the purpose in boilerplate. I learned a lot about how I could improve my Backbone code, and these two sections actually inspired me to start integrating Marionette into a project at work. The application structure advice in the fourth part is also particularly strong, with quality information about events, and ideas on how to scale a Backbone application beyond TodoMVC sizes.
On the other hand, the appendices feel a bit tacked on, and seem to be full of stuff the author wanted to add but couldn't figure out how to weave into the rest of the book. Since it's legitimate content rather than simply greater detail on things that have been already covered, they don't act as real appendices and leave the book feeling a bit unfocused at the end. When you combine that with some weaker content in part 3 (where the author moves away from Marionette into some other smaller examples), the book can feel a bit choppy and directionless. But the goldmine of knowledge and perspective in Parts 1, 2 and 4 more than make up for it.
- Building Backbone Plugins - You can purchase the book on leanpub. (Note: Affiliate Link)
- Developing Backbone Applications - This book by Addy Osmani is a great resource for Backbone Beginners who want a more basic introduction to Backbone concepts. It's available as a free HTMl site on github, but you also can purchase it as a paperback or ebook.
- Marionette.js - This framework serves as the inspiration for Derick's book and is a great way to structure larger Backbone apps.