O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Started with Backbone Marionette

Book Description

If you know JavaScript and a little Backbone.js, this book is just what you need to move your speed and efficiency up a gear. It's a complete and practical guide to the composite application library Backbone Marionette.

In Detail

Backbone Marionette is a composite application library for Backbone.js that aims to simplify the construction of large-scale JavaScript applications. It is a collection of common design and implementation patterns found in the applications that we build with Backbone, and it includes pieces inspired by composite application architectures, event-driven architectures, and messaging architectures.

This guide will help you learn some key concepts that will allow you to build large-scale applications with ease. You will learn how to add new features quickly and easily using a solid and composite Backbone Marionette framework. This book is a practical guide to developing scalable applications using an incremental and modular approach with Marionette.js.

This book begins by showing you the key benefits of Marionette.js and how to set up a development environment so you can begin writing code using this framework. It then walks you through the main components of the library such as the router, controller, and application. After that, it introduces you to topics like view types and the view life cycle before moving on to more advanced topics such as modularization, enterprise messaging patterns, incremental use, and memory management.

Getting Started with Backbone Marionette contains a lot of infrastructural examples that will help you to build an application of virtually any module size. It provides you with a collection of common design and implementation patterns to break your applications into small pieces. It then wraps-up by implementing extended capabilities like asynchronous module definitions and handlebars.

What You Will Learn

  • Install and understand the core concepts of Backbone Marionette
  • Orchestrate views with a controller object
  • Divide your application into logical independent regions
  • Manage an object's life cycle to avoid memory leaks
  • Reduce boilerplate and glue code normally needed in Backbone Development by decoupling your JavaScript applications into modules.
  • Provide structure, organization, and pattern to your Backbone code

Table of Contents

  1. Getting Started with Backbone Marionette
    1. Table of Contents
    2. Getting Started with Backbone Marionette
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
      2. Why Subscribe?
        1. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Starting with Backbone Marionette
      1. Introducing Marionette.js
        1. Backbone needs Marionette.js
        2. Key benefits of Marionette.js
        3. Building large applications
        4. Incremental use
      2. Installing Marionette.js
        1. Text editor
        2. Web browser
        3. Prerequisites
        4. Getting Marionette.js
        5. Documentation
      3. Summary
    9. 2. Our First Application
      1. Introduction to what we are building
      2. Setting up our development environment
      3. The Backbone.Marionette.Application object
        1. Backbone already has a router!
      4. Summary
    10. 3. Marionette View Types and Their Use
      1. Marionette.View and Marionette.ItemView
        1. Handling events in the views
        2. UI and templates
        3. Marionette.CollectionView
        4. Marionette.CompositeView
      2. Building the layout of our application with Marionette.Layout
      3. Extending Marionette views
      4. Summary
    11. 4. Managing Views
      1. Understanding the Marionette.Region object
      2. Using the Marionette.RegionManager object
      3. Using the Backbone.BabySitter object
      4. Taking advantage of the Marionette.Renderer object
      5. Improving the performance of the application with TemplateCache
      6. Summary
    12. 5. Divide and Conquer – Modularizing Everything
      1. Applying the divide and conquer principle
      2. Modularizing single-page applications
      3. Getting started with modules
      4. Splitting modules into multiple files
      5. Implementing initializers and finalizers
      6. Working with subapplications
      7. Using the route filter
      8. Memory considerations
      9. Summary
    13. 6. Messaging
      1. Understanding the event aggregator
      2. Using the event aggregator of Marionette.js
        1. Making applications more extensive with an event aggregator
      3. Getting started with Commands
      4. Setting up the RequestResponse object
      5. Summary
    14. 7. Changing and Growing
      1. Using AMD
        1. Using the Require.js library
        2. Configuring Require.js
      2. Defining our application module
        1. Writing the subapplications using Require.js
        2. Modularizing all your components
        3. Adding the text plugin
        4. Structuring your files
        5. Using handlebars as a template engine in Marionette
      3. Summary
    15. Index