title: Backbone.js factory design pattern implementation
body: <p>I am looking for advice on whether this implementation of the factory design pattern to a Backbone.js collection is a bad implementation.</p>
  
  <pre><code>Collections.MyObjects = Backbone.Collection.extend({
  
      model: Models.MyObject
  
  });
  
  Collections.MyObjects.getInstance = (function(){
  
      var instances = {},
          defaultName = 'default';
  
      return function(name)
      {
          name = name || defaultName;
  
          if (!instances[name])
          {
              instances[name] = new Collections.MyObjects();
          }
  
          return instances[name];
      };
  
  })();
  </code></pre>
  
  <p>I am looking for alternative implementations and performance optimizations/theories.</p>