Skip to content
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

should we use a tandem "marker entry" in options? #262

Closed
pixelzoom opened this issue Aug 23, 2016 · 26 comments
Closed

should we use a tandem "marker entry" in options? #262

pixelzoom opened this issue Aug 23, 2016 · 26 comments

Comments

@pixelzoom
Copy link
Contributor

Noted in #259 (comment)

I had some confusion about whether ArrowButton was instrumented, and said:

No tandem appears in the ArrowButton source code, but it is passed through to its supertype (RectangularPushButton), where it appears to be handled properly.

Looking at ResetAllButton (a subtype of RoundPushButton), I see:

tandem: null // Marker entry to indicate that tandem is supported (in the parent)

Should ArrowButton have a similar "marker entry" in its options? Is this a convention that we're going to use?

@pixelzoom
Copy link
Contributor Author

In #259 (comment), @samreid said:

I have mixed feelings about the marker and would like to discuss it before we decide. I suppose at the moment I'm leaning toward "delete them because they are duplicated information and it would be crazy to have marker entries for everything" though I do see the advantage of being able to easily see if something is instrumented in a parent class. Perhaps there is a better way to proceed.

@pixelzoom
Copy link
Contributor Author

Labeled for discussion at developer meeting.

@samreid
Copy link
Member

samreid commented Aug 25, 2016

@jbphet points out this is just a holdover until tandem is supported broadly.

We would rather not duplicate options, and we should remove the marker entries.

@samreid
Copy link
Member

samreid commented Aug 25, 2016

Marked with high-priority to put it on my todo list.

@samreid
Copy link
Member

samreid commented Aug 29, 2016

If we decide to proceed with non-null tandems in common code options as discussed in https://github.com/phetsims/phet-io/issues/562 then perhaps it makes sense to declare tandem: Tandem.createOptionalTandem('myClass') at each point in the hierarchy--the subclassiest one will take effect. Should be discussed with @andrewadare before proceeding.

@samreid
Copy link
Member

samreid commented Aug 30, 2016

@andrewadare the pattern that we discussed today sounds good, and in a subclass hierarchy, each class will specify tandem: Tandem.createDefaultTandem('myClass'). This is in effect like a "marker entry" but one that will work well with our non-null tandem pattern. I'll unassign but leave open and we can re-evaluate after https://github.com/phetsims/phet-io/issues/562 is complete.

@samreid samreid removed their assignment Aug 30, 2016
@pixelzoom
Copy link
Contributor Author

@samreid @andrewadare Is this issue still relevant?

@andrewadare
Copy link
Contributor

Yes, thanks for the reminder. In fact it is more relevant now that phetsims/phet-io#562 is done. I will flag for discussion with other PhET-iO devs.

@andrewadare
Copy link
Contributor

Noting here for future reference: FaucetNode.js in scenery-phet is a nice example to follow. It includes the createDefaultTandem call, good comments, and disposal code.

@samreid
Copy link
Member

samreid commented Nov 21, 2016

The pattern in ArrowNode is a good pattern, with the caveat that TArrowNode should be used instead of TNode.

There are 13 tandem: null in sun and 9 in scenery-phet. 43 across all of our repos (including sun and scenery-phet).

To do this right, we should:

  • replace tandem: null with tandem: tandem.createDefaultTandem('myType')
  • make sure all sites have tandem.addInstance()
  • make sure all sites have tandem.removeInstance() implemented in a private disposeMyType function, which is called from the public dispose function.
  • add Tandem.validationOptions(options)

Before tackling this, we should:

The latter checkbox needs a separate issue.

@samreid
Copy link
Member

samreid commented Nov 21, 2016

On hold until https://github.com/phetsims/phet-io/issues/158 is complete.

@mattpen mattpen assigned samreid and unassigned andrewadare Dec 8, 2016
@samreid
Copy link
Member

samreid commented Jan 3, 2017

The problem is that scenery-phet and other libraries are still using tandem: null, so when subclassing a sun component, the tandem is passed in as null, but sun expects it to be non-null.

samreid added a commit to phetsims/joist that referenced this issue Jan 3, 2017
samreid added a commit to phetsims/sun that referenced this issue Jan 3, 2017
samreid added a commit to phetsims/vegas that referenced this issue Jan 3, 2017
samreid added a commit that referenced this issue Jan 3, 2017
samreid added a commit to phetsims/gravity-force-lab-basics that referenced this issue Jan 3, 2017
samreid added a commit to phetsims/vegas that referenced this issue Jan 3, 2017
@samreid
Copy link
Member

samreid commented Jan 3, 2017

After the above commits, aqua requirejs tests are passing again for PhET brand.

@zepumph
Copy link
Member

zepumph commented Jan 3, 2017

I updated all tandem: nulls in scenery-phet

@zepumph zepumph removed their assignment Jan 3, 2017
@pixelzoom
Copy link
Contributor Author

@samreid @zepumph What is the status of this issue? Is there more work to be done here? Something to review? Ready to close?

@zepumph
Copy link
Member

zepumph commented May 8, 2017

Thanks @pixelzoom for bring it back up.

zepumph added a commit to phetsims/charges-and-fields that referenced this issue May 12, 2017
@zepumph
Copy link
Member

zepumph commented May 12, 2017

I got rid of the last two spots that had "tandem:null" (Property and ObservableArray) in the project. This helped to catch a bug in MAL as well, where tandems weren't being passed into Photon.

Here are the related commits,

tandemOptional in Property.js, factor Optional/RequiredAndNotSupplied into required and supplied options
phetsims/tandem@294a42d

instrument MAL after observableArray update
phetsims/molecules-and-light@89857f6

tandemOptional in Property.js
phetsims/axon@3471b08

tandemOptional in ObservableArray.js
phetsims/axon@2a21804

@samreid would you please look over these commits and make suggestions. I think this is probably ready to close after review.

@zepumph
Copy link
Member

zepumph commented Jun 16, 2017

@samreid here I think a review just needs to look at the above commits for fowl play. Check to make sure that tandem: null was replaced correctly.

@samreid
Copy link
Member

samreid commented Aug 3, 2017

The preceding commits look great, thanks! Closing.

@samreid samreid closed this as completed Aug 3, 2017
jessegreenberg pushed a commit to phetsims/greenhouse-effect that referenced this issue Apr 21, 2021
jessegreenberg pushed a commit to phetsims/greenhouse-effect that referenced this issue Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants