-
Notifications
You must be signed in to change notification settings - Fork 5
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
Understanding Tandem #165
Comments
Worth noting that I also flagged this in #179, where I noted:
I agree that longterm, this sim should be converted to pass tandems via options, since that the preferred pattern. |
@zepumph said:
Oops. In #179, I changed FocalPoint because it was the one example that was different. I think I'll strip out the |
I deleted Closing. |
I see lots of places where Tandem is passed through, so I thought I would take a moment to explain why that worked its way into your sim, and what its purpose it.
Tandem is a glorified string identification tree/concatenator. It allows you to pass objects around to make ids like "screen.model.component.xProperty". It is used in its entirety for PhET-iO, and so it doesn't really need to be added to your sim at this time.
If you were going to pass the general tandem structure around (which isn't a horrible idea because it sets us up well for when this sim gets PhET-iO, then we have a more updated pattern that you can follow. Except for passing directly to the model and screenView, tandems are predominantly passed via options. Thus, I would consider the majority of
tandem
parameters in this sim to be out of date conventionally. I updated to the current pattern in FocalPoint.js, and changed usages just so you can be aware of this pattern. This is further outlined in https://github.com/phetsims/phet-io/blob/master/doc/phet-io-instrumentation-technical-guide.md#best-practices-for-tandem.When this sim gets PhET-iO, this refactor will want to happen. Whether or not we do this now doesn't really matter to me.
To summarize:
tandem.createTandem( 'subComponentName' )
as opposed to passing the same instance everywhere.The text was updated successfully, but these errors were encountered: