Building Backbone Plugins (The Book + The WatchMeCode Screencasts)
Minimum price
Suggested price

Building Backbone Plugins

Eliminate The Boilerplate In Backbone.js Apps

About the Book

Stop Building Apps With Broken, Boilerplate JavaScript

Master the art of extending and scaling Backbone.js … with just ONE book

Introducing …

Building Backbone Plugins

Extending Backbone.js The Smart, Scalable Way

  • Learn dozens of time-saving secrets
  • Build apps that can handle massive growth
  • Say goodbye to spaghetti-code solutions
  • Make better architecture decisions
  • Write maintainable, problem-free JavaScript

Because There’s a World of Difference Between Using a Framework … and KNOWING It

Get Back to Coding Cool Features Again

You’re not paid to build frameworks — you’re paid to build apps that solve the needs of your business. Building Backbone Plugins will free you from boilerplate code so you can focus on writing your application’s features.

Stop Fumbling Around Your Codebase

Keeping code small and readable is critical as your application evolves. Understanding — at a glance — what the code in any given file does is what makes the difference between being productive and flailing around for hours.

Put an End to Copy & Paste Programming

Boilerplate code requires you to copy-and-paste large chunks of code. Copy-and-paste code creates duplication. Duplication creates a maintenance nightmare. This book will teach you how to stop code-bloat in its tracks with powerful, easy-to-maintain abstractions and extensions.

Minimize Code, Maximize Freedom

Master the art of writing less code that does way more. After stripping down and streamlining your codebase with the help of this book, you’ll have more time to actually implement and improve those inspired, nice-to-have features you love but kept having to put on the back burner.

Understand WHY, Not Just How

This isn’t just a how-to book. It’s a why-to book designed to clarify the concepts and logic that hold Backbone together. Learn the “why” and “how” of building Backbone extensions without losing hours, days, even weeks to hopeless, confusing trial-and-error.

Build Fully Stocked App Architectures

Backbone offers a great, lightweight way to organize jQuery and other JavaScript code, but the trade-off is a lack of a complete app architecture. Building Backbone Plugins fills this gap by showing you what it takes to build scalable applications in Backbone and how to stock your toolbox with exactly what you need.

Get Real-Life, Real-App Tools & Techniques Distilled from Years of Experience with Backbone.js

I don’t know about you, but when I first starting using Backbone.js, I fell in love with it almost immediately.

After weeks of tearing my hair out over the hopeless tangle of JavaScript I’d “built” into my latest app, Backbone seemed like the answer to my prayers:

All of the patterns and practices that I’d learned from Windows development and thick GUI applications right there in front of me … only in JavaScript!

But it wasn’t long before I realized that using Backbone raised problems of its own: for one, a heavy reliance on copy & paste programming. To build out my apps, I had to keep adding more and more boilerplate code — the stuff that has to be there or nothing works right.

All that copy-and-pasting of code inevitably led to the copy-and-pasting of errors … which then required copy-and-paste fixes.

And that, frankly, is a ridiculous and wasteful way to code.

Based on my own trial & error-riddled experiences building MarionetteJS for Backbone, Building Backbone Plugins boils down more than 15 years of software development experience into one simple, easy-to-follow handbook designed to meet the real-life needs of actual JavaScript developers and their clients.

Using MarionetteJS as a reference, this book will show you how to write cleaner, more flexible JavaScript as well as how to keep your applications organized and easy-to-maintain — no matter how complex they get.

– Derick Bailey, creator of MarionetteJS

What Others Are Saying (and Loving!) About The Book

“A treasure trove of knowledge for the Backbone developer concerned with application architecture and extending Backbone” - Chris Webb

“The perfect read given that I was using Backbone in an unstructured manner, leaving many design paradigms in the dust … A great guide on how to transition from a mediocre Backbone web developer to a full-fledged software engineer with Backbone under their tool belt.” - Peter Tseng

“[This book] exposes parts of Backbone that many don’t know about and clearly shows how to extend Backbone in helpful ways that are generic enough to be usable by large numbers of users/projects.” - Joe Zimmerman

“[Building Backbone Plugins] provided me with a bunch of conceptual tools… good enough to roll my own!” - Domingo E. Savoretti

“Gave me a deeper understanding of event-driven applications, what a good backbone architecture looks like, and how to write cleaner code… All the code and examples can be traced back to Marionette, a real-world open source library … I got immediate benefit by applying it at work as I was reading the book, without having to create a project just to try out the concepts!” - Roberto Guerra

“The things I learned from this book will go a long way in both improving our code base as well as the skill-set of my team as a whole!” - Jason Krol

“This book has helped me gain a better understanding of Backbone.js — which will benefit me as well as my clients going forward.” - Paul Paulson

“I see Backbone plugins in a different light now as a result of this book. Whereas previously I regarded plugins as a last resort, now I think of plugins more as an essential enhancement to the Backbone framework. Plugins as explained in this book add a stronger procedural abstraction capability to Backbone … It reminds me somewhat of the power of C++ template metaprogramming compared to early versions of that language that lacked templates.” - Bodine

“I was surprised at the clarity of language and exposition [of Building Backbone Plugins] … This has a degree of polish comparable to books from O’Reilly or Manning. Geeky expertise we expect; clear writing is rare!” - Bodine

“Through example, this book walks you through the common challenges faced in Backbone development and how to sanely tackle those challenges … At least, that’s how it helped me!” - Michael Raumer

“This book is a reference for me every time I pick Backbone as the major library to deal with anything I build on the client side.” - Rui Pedro Lima

“[This book] showed me how Backbone really becomes powerful when properly handling events, especially in the context of using event handlers to trigger change in separate modules. … It’s helping me improve the maintainability and overall quality of the code I’m writing.” - Mike Tiemey

About the Authors

River Bailey
River Bailey

Derick Bailey is an entrepreneur and software developer in central Texas He's been slinging code since the late 80’s and doing it professionally since the mid 90's. These days, He blogs at, produces screencasts at and tweets as @derickbailey.

Jerome Gravel-Niquet
Jerome Gravel-Niquet

Software Engineer. Creator of Backbone Todos. Autodidactic designer, web developer and entrepreneur.


The Book

Get the book by itself. If you already have my screencasts from, then this package is for you.

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price
The Book + The WatchMeCode Screencasts

Get the book + the screencasts that are referenced as additional information, all for one low price! This package includes 4 videos, covering these topics in JavaScript: * Variable Scope In JavaScript * JavaScript Context * Objects and Prototypes * When Context And Prototypes Collide!

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price

Bundles that include this book

Bought separately
Bundle Price
Bought separately
Bundle Price

Table of Contents

    • Quotes And Praise For Building Backbone Plugins
    • Preface
      • Better, Faster, Cheaper
      • What Is Backbone?
      • Why Are Plugins And Add-ons Neccessary?
      • Who Should Read This Book?
    • In Relation To MarionetteJS (Backbone.Marionette)
    • Copyrights, Code License And Distribution
  • Part 1: Backbone Views
    • Chapter 1: View Rendering
      • Extract Whats Common, Specify The Differences
      • Lessons Learned
    • Chapter 2: Naming And Namespacing Your Plugin
      • Lessons Learned
    • Chapter 3: Complex And Divergent Views
      • onRender
      • Default serializeData Implementation
      • Extracting ModelView And CollectionView
      • Lessons Learned
    • Chapter 4: Building A Better CollectionView
      • Rendering A Collection Of Views
      • API-First Design Of The New CollectionView
      • Rendering Models With A modelView Setting
      • Render A New View On Model Add
      • Remove A View On Model Remove
      • Close All The Children With The Parent
      • Re-Render The Entire List On Reset
      • View-Per-Model vs Iterating Models In A Template
      • Lessons Learned
    • Chapter 5: Cache Pre-Compiled Templates
      • A Texas 2-Step
      • Building A Template Cache
      • A getPrototypeOf Shim
      • Lessons Learned
    • Chapter 6: Overriding Backbone.View’s ‘constructor’
      • Setting An Automation ID On All Views
      • The Problem Of Taxidermy
      • Correctly Overriding The Constructor Function
      • Putting The Pieces Together
      • Not Just Backbone.View
      • Not Every Type You Define
      • Lessons Learned
  • Part 2: Managing The DOM
    • Chapter 7: Managing DOM Widgets And Controls
      • DOM Dependent/Independent
      • Simple Manipulations And Events
      • DOM Events And Simple Animations
      • jQuery Plugins And UI Controls
      • DOM-Dependent UI Controls
      • Extracting The onShow Method Call
      • Lessons Learned
    • Chapter 8: Swapping Views In The DOM
      • A Need To Change Out A View
      • A Simple Region For Backbone
      • Extracting A Reusable Region Type
      • Handing onShow Calls
      • Lessons Learned
    • Chapter 9: Managing Nested Views
      • Nested Views: The Hard Way
      • Defining A Layout, Use-Case-First
      • Build The Layout Type
      • Closing The Regions With The View
      • Re-Rendering The Layout With Regions
      • Lessons Learned
  • Part 3: Data And Meta-data
    • Chapter 10: Pickable Models
      • Options For Storing Picked State
      • Backbone.Picky Namespace
      • Picky.PickableModel
      • Using A SelectableModel
      • Lessons Learned
    • Chapter 11: Pickable Collections
      • Multi-Pick Collections
      • Listening For Model Picks
      • Cleaning Up Event Listeners
      • The “pickAll” and “unpickAll” Methods
      • Necessary Duplication… For Now
      • The “togglePickAll” Method
      • Handling Removed Models
      • Using A MultiPickCollection
      • Lessons Learned
    • Chapter 12: Building Backbone.localStorage
      • Storing data on the client
      • Overriding Backbone.sync properly
      • Syncing the data
      • Universal Module Definition
      • Lessons Learned
    • Chapter 13: A Filtered Collection
      • Basic Filtering
      • View-Controlled Filtering
      • Self-Filtering Collections
      • Pure Filtering And Clean Collections
      • Rendering The Filtered Collection
      • Lessons Learned
  • Part 4: Application Infrastructure
    • Chapter 14: 3rd Party Events, Commands, And Requests
      • Event Aggregators
      • Commands
      • Request/Response
      • Lessons Learned
    • Chapter 15: Boot-strapping A Backbone Application
      • An Application Object
      • Using Initializers And Starting The App
      • Promising To Run Initializers
      • Starting Routers
      • Lessons Learned
    • Chapter 16: Application Workflow
      • A Poorly Constructed Workflow
      • Model Explicit Workflow
      • The Challenge Of Workflow Objects
      • Lessons Learned
    • Chapter 17: Building With Components
      • Defining A Component Constructor
      • An .extend-able Component
      • Handling Events Within The Component
      • Building A FilteredList Component
      • Using The FilteredList Component
      • Lessons Learned
  • Appendices
    • Appendix A: Managing Events As Relationships
      • The Observer Pattern
      • Events And Relationships
      • Inverting The Observer Relationship For Backbone.View
      • No Silver Bullet For Modeling Relationships
    • Appendix B: 3 Stages of App Initialization
      • Stage 1: Download And Parse
      • Stage 2: Application Initialization
      • Stage 3: State Restoration (optional)
      • Lessons Learned
    • Appendix C: A Tale Of Two Patterns
      • Event Aggregator
      • Mediator
      • Similarities And Differences
      • Relationships: When To Use Which
      • Pattern Language: Semantics
    • Appendix D: Better JavaScript Mixins
      • Object Extension Is A Poor Man’s Mixin
      • A Problem Of Context
      • Solving The Mixin Problem
      • A Real Example
      • Simplifying Mixins
      • An Alternate Implementation: Closures
      • Potential Drawbacks
      • Backbone.Include
    • Appendix E: Theme And Variation
      • Selecting vs Picking
      • Knowing When To Move On
      • Lessons Learned
    • About Derick
    • About Jerome Gravel-Niquet
    • A Special Offer From Derick

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub