Consulting, convening, coding, covering new ground, plus occasional commentary.
coding
Weekend reading: Backbone.js
Two book reviews from the road
With several hours of road between Vancouver and Tofino, not to mention a couple of ferry boat journeys, I threw two recently published books into my “offline book bag” and started reading.
In the few moments when I wasn’t out on a boat, getting sunburnt, or watching whales off the majestic coast of B.C. this past weekend, I was hiding out with an espresso and my iPad taking furious notes on everyone’s favourite JavaScript library, Backbone.js.
Though Backbone has been around for almost four years now, it only reached 1.0 status – typically a release that developers consider to be stable enough to support for a while – around this time last year.
As I sat down and sketched out a couple of projects on the horizon that would need to facilitate a fair amount of user interaction with data, I realized that it was time to do some catch-up reading…
Developing a Backbone.js Edge
Many years ago, I made one of the best investments of my business life: A subscription to Safari Books Online. I believe that I get a big return on investment for the $400 that it costs each year – basically, every technical book under the sun at my fingertips. And thanks to the “offline book bag” feature, I can load up the iPad version of the app with my current reading list for Internet-free enjoyment.
The first book I read was by Developing a Backbone.js Edge Bleeding Edge Press (one of the nice things about Safari Online Books is that they’ve got agreements with just about every publisher in the technology books space).
Developing a Backbone.js Edge was a quick read. It covered all of the basics of the library without going into too much detail. Definitely a better starting point than the Backbone documentation for those not familiar with the basic concepts that separate this library from other JavaScript frameworks.
The example app that this book steps through builds on the Github API, which is a nice demonstration of the Backbone approach to working with RESTful resources. This book also explains how to use technologies like localstorage to reduce the HTTP requests or to keep apps responsive in low-bandwidth situations (like ferry boats!).
It was a solid read, but left me wanting more.
Beginning Backbone.js
The other book I had in my offline book bag was Beginning Backbone.js, published by Apress. This book was published eight months after Developing a Backbone.js Edge, also roughly eight months after the 1.0 release, is about twice is long, and already has some high ratings from reviewers.
Though it covered a lot of the same terrain, this book was particularly well organized and aimed at connecting the Backbone concepts to other familiar patterns in software and Web development. I finished reading it feeling like I had a fuller understanding of where Backbone is positioned in the field of similar library and framework options, and where to go next in terms of the Backbone ecosystem of extensions or with related projects like Marionette.
This book also introduced topics like testing, pre-processing, and so on, but at the end of the book which made more sense to me. The section on best practices, as well as the one on manageable code, where both useful additions.
Both books skim across the concept of test-driven development. As mentioned, given that its something people are likely already doing or unlikely to start doing based on one of these books, I preferred it left until after some “meat” had been put on the bones. Beginning Backbone.js, however, provided a more thorough overview of testing in JavaScript, including practical sections on creating mock objects and fake servers using Sinon.JS.
The complete app example in this book – a Twitter-based application – similarly takes a journey through RESTful concepts, as well as more contemporary example of using localstorage, and then continues to demonstrate how to evolve the application to use Marionette, Thorax, and even RequireJS. Seeing the relationship between Backbone and other libraries and was the real learning in this book for me.
Backbone patterns
There are lots of great resources online for Backbone.js: from the project’s own documentation to tutorials. Probably enough to keep even a ravenous reader going for days, in fact.
However, the one resource that I found the most exceptionally useful was: Backbone patterns. Specifically, the sections on:
- Conventions: naming, namespaces, and so on.
- Anti-patterns: how to play nice with jQuery and more.
So, there you go, two quick book reviews. Enjoy.
And, while we’re here, let me ask: What are your favourite reads or resources on Backbone.js? Drop them in the comments or send me a note on Twitter.
About
Hi, I'm Phillip Smith, a veteran digital publishing consultant, online advocacy specialist, and strategic convener. If you enjoyed reading this, find me on Twitter and I'll keep you updated.
Related
Want to launch a local news business? Apply now for the journalism entrepreneurship boot camp
I’m excited to announce that applications are now open again for the journalism entrepreneurship boot camp. And I’m even more excited to ...… Continue reading
Previously
Data Boot Camp B.C.
From the future
Recipes for delicious tasting static news apps