recipeswithbackbone/recipeswithbackbone.github.com — Issue #21: Singleton View should be Anonymous View
Author: ngauthier
Created: 2011-11-20 17:11:11+00:00
State: open

A Singleton pattern is for an object that should only be instantiated once but is references in many places. It is a cleaner way of doing a global variable.

However, in our case, it's more of an anonymous view. In many cases a reference to the view is not needed and rarely do other pieces of code need to call methods on the view. It should be instantiated with a model or collection and an element and then not referenced again (except potentially in the router, but this can be done by instantiating the view to a local variable and passing it to the router).