PacktLib: Backbone.js Patterns and Best Practices

Backbone.js Patterns and Best Practices


About the Author


About the Reviewers


Reducing Boilerplate with Plugin Development

Basic components of Backbone.js

Using Underscore.js

Re-using code with extensions

Understanding JavaScript mixins


Working with Views

Basic usage of views

Partially updating a view

Understanding nested views

Working with templates

Understanding automatic model-view data binding

Using Marionette's ItemView, CollectionView, and CompositeView

Using Layout Manager


Working with Models

Basic usage of models

Validating the data

Serializing models

Understanding the relational data model


Working with Collections

Basic usage of collections

Sorting a collection

Filtering a collection

Understanding the collection of multiple model types


Routing Best Practices and Subrouting

Working with routers

Best practices for working with routers

Subrouting – a key to organizing complex apps


Working with Events, Sync, and Storage

Understanding custom events

Using an event dispatcher

Avoiding memory leaks with the listenTo() method

Overriding the Backbone.sync() method

Offline storage using the Backbone.LocalStorage adapter


Organizing Backbone Applications – Structure, Optimize, and Deploy

Understanding the application directory structure

Working with Asynchronous Module Definition

Creating application architecture


Unit Test, Stub, Spy, and Mock Your App

Understanding why unit testing is important

Testing with QUnit

Using test spies, stubs, and mocks with SinonJS


Books, Tutorials, and References

Books, Tutorials, and References

Books, Tutorials, and References

Precompiling Templates on the Server Side

Organizing Templates with AMD and Require.js

Organizing Templates with AMD and Require.js