Written by Joseph Zimmerman and reviewed by the creator of MarionetteJS, Derick Bailey.
To help you tap the full potential of Marionette in your next project, we created Better Backbone Applications with MarionetteJS. Filled with hands-on examples, the eBook guides you through the different components Marionette has to offer. Finally, to help you understand how these pieces fit together, a sample application demonstrates how Marionette could work for you.
Please note that this eBook is based on version 1.3.0 of MarionetteJS.
A free preview of the eBook is available for download here.
TABLE OF CONTENTS
- Chapter 1: Application
- Chapter 2: Modules
- Chapter 3: Views
- Chapter 4: ItemView
- Chapter 5: CollectionView
- Chapter 6: CompositeView
- Chapter 7: Region and Layout
- Chapter 8: Events, Commands, and Requests and Responses
- Chapter 9: AppRouter
- Chapter 10: Controller
- Chapter 11: Introducing Our Example Application
- Chapter 12: Decisions and Setups
- Chapter 13: Building a Foundation
- Chapter 14: Managing Data
- Chapter 15: The Home Screen
- Chapter 16: The Quiz Creator
- Chapter 17: Taking and Reviewing Quizzes
- Additional Resources
- Formats:: PDF, EPUB, Kindle (DRM-free)
- Pages: 155
- Language: English
- Released: March 2014
- Publisher: Smashing Magazine GmbH
- ISBN (PDF): 978-3-94454072-6
- ISBN (EPUB): 978-3-94454067-2
- ISBN (Kindle): 978-3-94454068-9
Excerpt From Chapter 1
Most of the time, when someone creates a Backbone application, they make a central object that everything is attached to, which is often referenced as
Applicationmost people just create a main router or view and make that the app object. While it’s great that people are attaching things to a central object so that the global namespace isn’t so convoluted, the router was not intended to handle this task and it violates the single responsibility principle.
This can be a problem. Without a central application to use as a namespace (or a module system that keeps variables out of the global scope), most objects and variables will be made globally accessible. While this may seem like it makes things simpler, it poses a substantial risk because variables can easily and unwittingly be overwritten, which can cause bugs that are difficult to track down.
Excerpt From Chapter 2
Before we get into the details of how to use Marionette’s module sys- tem, we should make sure we have a decent definition of what a mod- ule is. A module is an independent unit of code that ideally does one thing. A module is used in conjunction with other modules to create an entire system. The more independent a unit of code is, the more easily it can be exchanged or internally modified without affecting other parts of the system, and the more easily it can be tested.