Jump to ratings and reviews
Rate this book

Backbone.js Patterns and Best Practices

Rate this book
A onestop guide to best practices and design patterns when building applications using Backtbone.jsAbout This BookOffers solutions to common Backbone.js related problems that most developers faceShows you how to use custom widgets, plugins, and mixins to make your code reusableDescribes patterns and best practices for large scale JavaScript application architecture and unit testing applications with QUnit and SinonJS frameworksWho This Book Is ForThis book is for JavaScript developers who work with Backbone.js and want to learn the best design patterns to develop complex web applications. Basic knowledge of Backbone.js and JavaScript is essential.

What You Will LearnDevelop custom plugins and mixins to reduce boilerplate in your codeLearn about Backbone view management with nested views, subviews, layout manager, and Marionette viewsUnderstand template management by storing and pre-compiling templatesExplore model validation with validation plugins and learn model serialization and relational data management with nested modelsWork with collections to implement multiple sorting and filtering behaviorCreate solid application architecture with AMD and different popular design patternsIn DetailBackbone.js is a super light framework that allows you to structure your JavaScript codes in an MV* fashion. This framework is an excellent tool when it comes to creating an organized and modular code base for web apps of any size or complexity. Although lightweight, Backbone.js results in lots of boilerplate. Learning the best practices and design patterns will help you avoid these problems and allow you to ensure that the best standards are followed.

Backbone.js Patterns and Best Practices is packed with examples that will help you work with Backbone.js components. It also gives solutions to common problems faced by developers. It gives a complete overview of plugin development, large scale application architecture, and unit testing as well.

Starting with a discussion of why reducing boilerplate in your JavaScript code is essential, Backbone.js Patterns and Best Practices explains how to enforce reusability in your code by creating plugins and mixins. You will learn about patterns and best practices for Backbone views, models, collections, routers, and events.

You will discover solutions to common problems that developers face through simple examples, and delve into the best open source plugins available to solve these problems when they arise. This book is an excellent collection of design and implementation patterns that will help you structure and develop complex Backbone.js applications easily.

176 pages, Kindle Edition

First published January 24, 2014

3 people are currently reading
19 people want to read

About the author

Swarnendu De

3 books

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
6 (30%)
4 stars
8 (40%)
3 stars
3 (15%)
2 stars
1 (5%)
1 star
2 (10%)
Displaying 1 - 5 of 5 reviews
9 reviews
February 17, 2014
The author writes that this book requires some basic knowledge of Backbone.js - well, i would say that he is correct.
You do need to understand the basic concepts, but i´d definitely suggest it to anyone who is working with Backbone and you don´t need to be very experienced.

The book is not just about Patterns and Best Practices, the first half of it is more like a reference for Models, Views and Controllers. Which is good, because you don´t need an extra book for that and it helped me a lot as Backbone beginner.
Skip the first half of the book if you feel like a pro in Backbone, but don´t miss the second half because that´s where you get a deep knowledge of how you should structure your apps, including Require.js and AMD modules.
You don´t see separate recipe after recipe, which is good because every chapter fits together very well and explains all important aspects of Backbone.

So this is definitely worth to buy if you are interested in working with Backbone.js. Only Chapter 8 about unit testing is a bit too short in my opinion and i would have liked to see some testig with more professional frameworks like Jasmine or Mocha. But that´s more of a personal taste.
Profile Image for Carlos Ramos.
Author 3 books8 followers
October 25, 2017
Even when this book says you have to know Backbone before reading it, it covers enough information for it to be a basic book on the subject while, at the same time, showing the patterns that large applications use.

In all, a good read to learn about the Backbone framework, and the best practices, right from the start.

Totally recommended to anyone looking for information about Backbone.
21 reviews1 follower
March 10, 2014
Review - "Backbone.js patterns and best practices" by Swarnendu De

Finished reading the book.

Though Backbone.js provides a structure for JavaScript applications, developers need to take care of most of the design patterns and best practices themselves. Whether you are an intermediate- or advanced level Backbone.js developer, this book will guide you through the best practices and patterns to handle different issues with each Backbone component. Whether this is by using your own solution or an existing Backbone plugin, you will get a clear idea of the best way to resolve any problem.

Instead of developing a single application spanning all the chapters, a simple and complete example on each topic is provided separately throughout this book. The book starts with the basics of Backbone.js and the utility of using Underscore.js with Backbone.js. We also see how developing reusable components and custom plugins can reduce boilerplate from our code. It also discusses the concept of JavaScript plugins and different approaches for defining mixins, which we use several times in the subsequent chapters. We then move onto views, view rendering, handling nested views, diferent template handling methods and finally concludes with important extensions like Marionette and the Layout manager. Models and collections are handled next with discussions about lots of basic problems that develpers face. It also discusses about the different functionalities of Backbone collections, basic and multiple sorting, filtering mechanisms, and collections with multiple model types. Routing and the best practices for router managemant is explained in detail with explainiation about subrouting as well, which is a key to organizing complex apps. Custom events, event dispatcher, method overriding, offline storage are touched upon with discussions about the best practices for each, few plugins and extensions and common issues. Asynchronous module definition with require.js, application directory structure and application architecture are dealt with towards the end in relatively good detail. However no project is complete without testing and the last chapter covers that with details about Qunit and SinonJS.

Within a short span, this book tries to cover all the important points you may need for the development of your Backbone.js application. This book not a general intro to backbpone. Sonme backbone knowledge is essential. While this book does discuss the basics of the Backbone.js components in each chapter, the main priority is to provide you with the concepts of developing a robust, high quality, and flexible code base. There is a section at the end of the book providing pointers to different resources, books and tutorials. It is hugely helpful to furher your knowledge about backbone.

If interested, get the book here: http://www.packtpub.com/backbone-js-p...
2 reviews
March 9, 2014
This is a book I will continue to refer back to again and again. It presents the reader with clearly laid out examples and builds on basic examples to more complex scenarios in each section. When talking about various coding pattern choices, the author clearly explains why and under what circumstances a given design choice might be made; this greatly increases understanding and is often missed in books aimed at more intermediate coders.

Each chapter starts with a "Basic usage of..." section (each chapter covering views, models, collections etc. in turn) and builds on this basic usage example to introduce the common issues Backbone.js developers may come across when developing larger and more complex applications. There's frequently multiple ways of addressing each issue depending on preference and the author also encourages the use of some of the plugins that have been well developed to deal specifically with these issues such as Marionette and LayoutManager.

Rounding out the book in chapters 7 and 8 are two sections I haven't seen in many JS development books, especially books covering a specific framework like Backbone.js; application architecture design and unit testing. These two chapters turn this book into rather more than just your standard Backbone.js tutorial - they fill out the learning experience nicely to give you a full end-to-end design approach when developing your next application.

Overall, the author's experience shines through and gives the reader a confidence that the solutions presented have real-world knowledge to back them up. There's of course lots of Backbone.js resources available online, but I think that having such a wealth of information and experience presented in this format and coming through the voice of a single author helps maintain a consistency in learning you may not get elsewhere. I've taken a lot of new ideas away from my time with this book and I will continue to get more and more from it as I fully intend to re-read it as new issues arise in my own development projects.

379 reviews10 followers
July 6, 2014
Un buon manuale, con molti suggerimenti utili soprattutto per chi ha già una base di Backbone ma non ne è esperto.

Unico difetto è che non c'è una progressione logica. Alcune "ricette" sono banali, altre complesse, ma non in modo ordinato.

Displaying 1 - 5 of 5 reviews

Can't find what you're looking for?

Get help and learn more about the design.