How marionettejs/backbone.babysitter works
Project Type and Purpose
• This is a dedicated library/tool for managing child views in Backbone applications.
• The README explains that the core functionality is provided via the Backbone.ChildViewContainer constructor, offering methods to add, remove, and iterate over views.
• It is not a complete full-stack application; rather, it serves as an enhancement for Backbone projects and integrates with existing libraries like Backbone, Underscore, and jQuery.
File Structure
• Top-level files such as .gitignore, .travis.yml, Gruntfile.js, package.json, and bower.json show standard project configuration and build tooling.
• The "src" directory holds the source code (including childviewcontainer.js and a build subdirectory), while "lib" holds built versions.
• The "public" directory contains the distributed JavaScript files (Backbone, jQuery, Underscore, etc.) which demonstrate the library’s role in a browser environment.
• The "spec" directory reveals that testing (using Jasmine) is an integral part of the development process, so tests and their interactions are a component.
A. Core Library Component:
• Backbone.ChildViewContainer: Represent this as the central module.
• Inside the container, illustrate the internal storage and indexing strategy (by view.cid, model.cid, or custom keys).
• Methods for adding, removing, retrieving, and iterating over views.
• How this module abstracts the repetitive tasks associated with child view management.
B. Dependency and Integration Layers:
• Underscore.js: Represent its role in providing iterators and collection functions that the container borrows.
• jQuery and JSON2 (if applicable): Note that these may serve as supporting libraries in the public build, though their usage is more peripheral.
C. Development and Build Infrastructure:
• Build Process: Include a component for the build tools (Grunt, Travis CI, etc.) which ensures continuous integration and automated builds.
D. Testing:
• Testing Suite: Include a block for the Jasmine tests in the "spec" directory. Indicate that tests validate the functionality of the child view container methods.
Final Checklist
• A central block labeled “Backbone.ChildViewContainer” with all its methods and indexing strategies.
• Interactions with Backbone.View (inputs/outputs) and Underscore functions.