masylum/Backbone.Subset — Issue #4: parent() called in constructor, but impossible to set from constructor
Author: collin
Created: 2012-02-23 17:56:03+00:00
State: open

As seen here: https://github.com/masylum/Backbone.Subset/blob/master/backbone.subset.js#L23-26

'''js
Backbone.Subset = function Subset(models, options) {
options = options || {};

this.model = this.parent().model;
'''
The trouble with this is it effectively turns instances of Backbone.Subset into singletons, you have to define:

'''js
SomeSubset.prototype.parent = function() { /*....*/ }
'''

In such a way that it is very aware of the program implemented around it.

The data inside the class ought to be passed into the constructor, not the implementation of the class itself.