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

misuses of options pattern #22

Closed
pixelzoom opened this issue Feb 10, 2020 · 2 comments
Closed

misuses of options pattern #22

pixelzoom opened this issue Feb 10, 2020 · 2 comments

Comments

@pixelzoom
Copy link
Contributor

There is a definite misunderstanding about how to use options, which is one of PhET's fundamental design patterns.

Some examples:

  class OptionsPanel extends Panel {

    /**
     * @param {Object} [panelOptions]
     * @param {Model} model
     * @param {bool} doShowPhases
     */
    constructor( panelOptions, model, doShowPhases = false ) {
  class AmpPhaseAccordionBox extends AccordionBox {
    // TODO - comment code

    /**
     * @param {Object} [options]
     * @param {Model} model
     */
    constructor( options, model ) {
  class AmpSelectorRectNode extends Rectangle {

    /**
     * @param {Object} [options]
     * @param {Model} model
     */
    constructor( options, model, row, col, ampAxisProperty, maxAmpProperty, gridSizeProperty ) {

A description of PHET's "Options and Config" pattern can be found in PhET Software Design Patterns. Because it is optional, options should always be the last parameter.

@Hyodar
Copy link
Contributor

Hyodar commented Feb 12, 2020

Made some changes to the usage of options, though I think some of those classes could still use some cleaning up beyond just changing options to be the last constructor parameter.
I'll take a closer look tomorrow and then close the issue if everything is fine.

@Hyodar
Copy link
Contributor

Hyodar commented Feb 17, 2020

Closing. If necessary, it can be opened again.

@Hyodar Hyodar closed this as completed Feb 17, 2020
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

2 participants