You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportdefaultclassMeanShareAndBalanceModel{publicconstructor(providedOptions: MeanShareAndBalanceModelOptions){// Here for potential future use.}publicsyncData(): void{// See subclass for implementation}/** * Resets the model. */publicreset(): void{// See subclass for implementation}/** * Steps the model. * @param dt - time step, in seconds */publicstep(dt: number): void{// See subclass for implementation}}
MeanShareAndBalanceModel is not meant to be instantiated directly. It provides no properties, functionality, or default behavior. And (based on what I see in IntroModel) you're expecting the subclasses to override all of those empty methods. So MeanShareAndBalanceModel should be an interface.
As an interace, it would look like this:
interfaceMeanShareAndBalanceModel{syncData(): void;/** * Resets the model. */reset(): void;/** * Steps the model. * @param dt - time step, in seconds */step(dt: number): void;}exportdefaultMeanShareAndBalanceModel;
Interfaces are sometime named with an "I" prefix, like axon's IProperty. But PhET does not have a clear convention on this, so you decide whether it should be MeanShareAndBalanceModel or IMeanShareAndBalanceModel.
The text was updated successfully, but these errors were encountered:
By the way... If MeanShareAndBalanceModel had properties or provided default behavior, then I'd be recommending that you make it an abstract class. And while that's not the case now, it might become the case as you add screens to this sim.
@samreid suggested marking MeanShareAndBalanceModel as an abstract class for now as future screens get developed. We do anticipate adding methods or properties so will make abstract for the moment.
For code review #41 ...
MeanShareAndBalanceModel
looks like this:MeanShareAndBalanceModel
is not meant to be instantiated directly. It provides no properties, functionality, or default behavior. And (based on what I see in IntroModel) you're expecting the subclasses to override all of those empty methods. SoMeanShareAndBalanceModel
should be aninterface
.As an interace, it would look like this:
And usages would look like this:
Interfaces are sometime named with an "I" prefix, like axon's
IProperty
. But PhET does not have a clear convention on this, so you decide whether it should beMeanShareAndBalanceModel
orIMeanShareAndBalanceModel
.The text was updated successfully, but these errors were encountered: