-
Notifications
You must be signed in to change notification settings - Fork 8
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
Rename Action, instances of {Action}, and Action.emit() #243
Comments
Action is described as:
I think it would be redundant and inconsistent to name as |
At developer meeting we decided on |
|
Discussed yesterday during phet-io team meeting. The next step is to take the "composition" approach for a test drive. I would like to have @samreid along when exploring this. |
Discussed in dev meeting today, @pixelzoom wants to publish ph-scale before too long. We decided this doesn't need to block publication currently, but once we do the work to convert from inheritance to composition it should block publication until things get sorted out. We will let @pixelzoom know when we want to work on this, and perhaps hold off on this until he has taken rc shas. |
@zepumph said:
I have published 1.3.0-rc.1 for ph-scale and ph-scale-basics using master shas, so all clear to proceed. |
After spending a few minutes on this, it's unclear to me whether composition will be an improvement. For instance, For the sake of argument, say we have a Running this past @zepumph as a first line of defense before asking @pixelzoom. UPDATE: I tried using Action via composition anyways and ran into the problem of the data stream. Action extends PhetioObject and Emitter extends PhetioObject. They cannot have the same |
I think I agree with most of the above sentiment. I also think that emitters should not expose execute as a function. Here having two ways to do the same thing is a maintainability concern, for example right now an emitter executing and emitting may be the same thing, but not always in the future. Also it will be harder to update actions if some execute methods pertain to a sub type. I propose manually cutting out action related API in emitter that we deem implementation details. This will probably just look like an override with an error. A note about your composition attempt. It was my understanding that when making this change, emitter would not extend PhetioObject, and so any phetio related options would either become nested (less ideal), or be passed to the action, and the action would be the only instrumented piece. That is also less than ideal because we would then probably want to support emitter instances calling phetio object methods. So far I like keeping Inheritance most. |
@pixelzoom can you review the preceding comments and recommend a course of action? |
@samreid said:
Why not? That seems both correct and accurate. |
That seems to be leaking an implementation detail. Why should clients need to know or care to know what |
If we weren't concerned with PhET-iO, I doubt that we'd be having this discussion about inheritance vs composition. Composition is the clear choice here, and we seemed to agree on that awhile back in the comments. But now we're rationalizing ("Maybe we should rationalize this by saying...") that inheritance is the way to go. I don't think PhET-iO should weigh so heavily on our decisions about whether to use inheritance or composition, and I'm afraid that this may indicate a design flaw. |
I'd love to hear a response to the |
If I understand the You're saying that
And the analogy applies to emit() {
this.execute.apply( this, arguments );
} Problems with this analogy... First, it has maintenance consequences. It's impossible to enforce that Second, it's bad design. Adding aliases for Finally, the analogy doesn't hold up when we look at the class hierarchies. Yes, a Cat is a Mammal, so |
Here is the way I think we should proceed:
Rationale:
|
It seems we should have a discussion on this, marking for dev meeting--or maybe @pixelzoom @samreid and @zepumph can schedule a mini sub-meeting? |
As a counter analogy... |
Developer meeting consensus from today (from SR): We will keep it the way it is because it is cheap and easy, adding the override to |
Comitted above. @samreid please review. |
This seems to be a reasonable compromise, the change set looks good. Closing. |
From #222 and its review, we need a few renames. @pixelzoom wrote:
I think that a
Phetio
prefix may be superfluous, but I'm open to suggestions. This will effect the public phet-io api, marking as blocks publication. @samreid @chrisklus what do you think they should be named. Should we bring it to dev meeting?The text was updated successfully, but these errors were encountered: