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

fill in gaps in public-facing developer documentation #1022

Closed
pixelzoom opened this issue Feb 11, 2020 · 6 comments
Closed

fill in gaps in public-facing developer documentation #1022

pixelzoom opened this issue Feb 11, 2020 · 6 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

Over in phetsims/normal-modes#2, I did a code review of Normal Modes, contributed by a 3rd party. The review took longer than expected because the 3rd party was not aware of some of the essential tools and documentation that PhET relies on.

@ariel-phet asked me to create this issue based on my comment in phetsims/normal-modes#2 (comment):

Most of the deficiencies (e.g. lint, assertions) can be traced to deficiencies in PHET's documentation for 3rd-party developers. @ariel-phet we might consider triaging these GitHub issues to pull out the things that need to be improved in PhET doc.

In the case of Normal Modes, the 3rd party was not aware of:

  • assertions
  • lint
  • PhET Software Design Patterns doc (especially options pattern)

Looking through the GitHub issues related to the code review may identify some others, but those are the "big 3".

@samreid
Copy link
Member

samreid commented Apr 16, 2020

If assert was an import instead of a global, then users could have a clear path to navigating to it, then we can document it there?

@zepumph
Copy link
Member

zepumph commented Apr 23, 2020

From developer meeting today:

  • Not a super high priority
  • There are more developers out there using our code
  • Updating documentation is important
    • Running lint
    • enabled assertions (maybe we enabled by default)
    • Using es6 modules
  • Add assertions to example-sim/simula rasa as examples (there are none currently)

@pixelzoom volunteered to implement the last two bullets. Thank you @pixelzoom!!

pixelzoom added a commit to phetsims/example-sim that referenced this issue Apr 23, 2020
pixelzoom added a commit to phetsims/simula-rasa that referenced this issue Apr 23, 2020
pixelzoom added a commit to phetsims/phet-info that referenced this issue Apr 23, 2020
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Apr 23, 2020

  • Running lint

I added this to the "Utilities and Instrumentation for Development and Testing" section of the PhET Development Overview:

  1. Run grunt lint on the command line to check for lint errors. All code should be free of lint errors. (lint is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. PhET uses the eslint variant of lint.)
  • enabled assertions (maybe we enabled by default)

There was a sparse description of ?ea in "Utilities and Instrumentation for Development and Testing" section of the PhET Development Overview. I revised it to read:

  1. Run with query parameter ?ea to enable assertions in the code. The sim should run without any assertion errors. (Assertions are predicates about what should be true at specific points in the code. They are used to identify programming errors.)
  • Using es6 modules

This will presumably be addressed by phetsims/chipper#854, no action required here.

  • Add assertions to example-sim/simula rasa as examples (there are none currently)

I added assertions that type-check arguments to example-sim and simula-rasa. The example in example-sim explains what they are, and how to enable them:

    // This is an example of using assertions to check for potential programming errors. In this case, we are verifying
    // that the arguments have the expected type.  Run the simulation with query parameter ?ea to enable assertions.
    assert && assert( barMagnet instanceof BarMagnet, 'invalid barMagnet' );
    assert && assert( modelViewTransform instanceof ModelViewTransform2, 'invalid modelViewTransform' );

@ariel-phet please assigning someone to review.

pixelzoom referenced this issue in phetsims/phet-info Apr 23, 2020
@pixelzoom pixelzoom assigned ariel-phet and unassigned pixelzoom Apr 23, 2020
@ariel-phet ariel-phet assigned chrisklus and unassigned ariel-phet Apr 27, 2020
@ariel-phet
Copy link

@chrisklus please feel free to close once review (and any changes or back and forth that should take place) are complete.

@chrisklus
Copy link

Code and documentation changes look good. I tested the type checks added to simula-rasa with grunt create-sim and they're working as expected. Thanks @pixelzoom, back to you to close if all set.

@chrisklus chrisklus assigned pixelzoom and unassigned chrisklus Apr 27, 2020
@pixelzoom
Copy link
Contributor Author

👍 Closing.

samreid pushed a commit to phetsims/phet-info that referenced this issue Apr 23, 2022
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

5 participants