In my development of a backbone.js application, I have come to understand the role of each backbone "class" as follows:
- Model: This represents the data object, where the outcome of an API call is stored.
- Collection: An organized group of models, for example, a collection of all models representing "science fiction" books.
- Router: Maps page URLs to actions/events, such as 'site.com/help' directing to a
help: function(){}
- View: Visual representation of a model, rendering onto the DOM.
This has left me confused about where to put my "generic" code, like analytics and ad scripts, helper functions, tracking, etc.
What would be the standard practice for handling these elements? Should they be placed within a backbone view (even if they don't include any content for page display)? Is it necessary to utilize a module loader like Browserify or Require.js? I'd prefer not to involve additional libraries as the project is small and I want to keep overhead low.