I m adopting Backbone.js to render a small corner of an existing large web app. If this goes well, I can see Backbone.js growing to encompass the whole of the app, lending some much-needed structure to an organically-grown application. That s the preface. Now for the problem:
I have a select box which allows the user to select a reading plan. When the selection changes, the view updates some descriptive text, a calendar interface, and a little widget for marking today s readings as complete. The widget will have a checkbox for each reading (one or more) in today s entry and a button for continuing to the next day s reading. (You can see the current, non-Backbone version of this interface (minus the completion scheme) on the right-hand side of the existing app.
What is the appropriate granularity for each View? I ve identified the following "fiddly bits":
- The Tab itself, which encompasses all the contained controls.
- The select box
- The descriptive text, which responds to the select box
- The calendar, which responds to the select box
- The readings widget, which responds to the select box, and contains:
- Optionally, a "Start" button, which activates the current plan.
- When activated, one or more checkboxes corresponding to individual readings within today s entry.
- When activated, a "Next" button which completes today s entry and displays the next.
Should each of these bullet points get its own View? Just the major pieces (tab, select box, widget)? The first will result in quite a few Views. The first seems like it could lead to overcomplicated View implementations. What s best?
Note: I realize this could be interpreted as a wildly-subjective question, but I m still wrapping my head around Backbone.js and Javascript/DOM MVC patterns, and I m hoping that there is a narrow "this is what s intended/works best" from more experienced Backbone.js practitioners. Thanks!