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

Investigate replacing 'SubitizeGameLevel | CountingGameLevel' with NumberPlayGameLevel #99

Closed
pixelzoom opened this issue Dec 15, 2021 · 1 comment
Assignees

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Dec 15, 2021

For #84

  • Is inheritance used where appropriate? Does the type hierarchy make sense?

In CountingGameLevel.js:

  public step( dt: number ): void {
  }

I wondered why this no-op step method is here. I'm guessing that it's because in NumberPlayGameModel.js, you're expecting all levels to have a step method:

  public step( dt: number ): void {
    this.levels.forEach( level => level.step( dt ) );
  }

If that's the case, then step should be part of the NumberPlayGameLevel base class API, either as a default no-op implementation, or abstract. Ditto for reset, which should be public in NumberPlayGameLevel.

Then I noticed in NumberPlayGameModel.js:

  public readonly levels: Array<SubitizeGameLevel | CountingGameLevel>;
  public readonly levelProperty: Property<SubitizeGameLevel | CountingGameLevel | null>

It seems to me that there are a lot of places where you're using SubitizeGameLevel | CountingGameLevel that could be NumberPlayGameLevel. But you're missing some things that should be in the NumberPlayGameLevel API:

  • step
  • reset should be public
  • ??
@Luisav1
Copy link
Contributor

Luisav1 commented Dec 17, 2021

@chrisklus and I worked on this together. We weren't able to add the step function in the base class as an abstract without overriding it as a no-op in CountingGameLevel, so we just made it no-op in the base class and deleted it from CountingGameLevel. After that and making reset() public, we were able to use NumberPlayGameLevel as the parameter type everywhere. Closing.

@Luisav1 Luisav1 closed this as completed Dec 17, 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

3 participants