-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some options extend but apply the same value #94
Comments
Closing. |
I'm trying to understand the scope of your argument with a thought experiment. For instance, let's say I had a base class with a default of |
Yes. But not worth the effort involved in hunting down redundant specification of
Reasons why a subclass may redundantly specify an option value:
|
function AccordionBox( contentNode, options ) {
var self = this;
options = _.extend( {
// {Tandem}
tandem: Tandem.required,
I see, that makes sense.
These sound reasonable, should we add them to the phet-info/doc/phet-software-design-patterns.md or some other document? I'm not sure everyone on the team is aware of those points. |
Mea culpa - I looked for the function AccordionBox( contentNode, options ) {
var self = this;
options = _.extend( {
// {Tandem}
46 tandem: Tandem.required,
...
96 // phet-io support
97 phetioType: AccordionBoxIO,
98 phetioEventType: 'user',
// a11y options
tagName: 'div',
// Options will be provided to both title bar nodes
titleBarOptions: null
}, options );
These seem like common sense to me. But if you think they would be useful in a document, feel free to add them. |
Signed-off-by: Chris Malley <[email protected]>
Discovered during #14
I noted this code:
And also this code:
Since the tandem is required in the base class, it is redundant to specify its default as required in the subclass. When is it appropriate to have subclasses re-specify the same default value for an option? Only in cases where the base class value is likely to change.
I haven't checked if this pattern appears elsewhere, I thought I would bring up this case as one occurrence to be addressed, and @pixelzoom can resolve any other cases that are using this same pattern.
The text was updated successfully, but these errors were encountered: