phetsims / calculus-grapher

"Calculus Grapher" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
4 stars 4 forks source link

Code review #268

Closed pixelzoom closed 1 year ago

pixelzoom commented 1 year ago

PhET Code-Review Checklist (a.k.a "CRC")

Specific Instructions

We would like to being dev testing by Monday, March 20, and we will need a few days to address review feedback. So this review needs to be completed by end-of-day Wednesday, March 15. If you do not think that is possible, please contact @kathy-phet or @pixelzoom ASAP to discuss.

If you have questions, or would like someone to tag along during the code review, please contact @pixelzoom or @veillette on Slack.

GitHub Issues

The following standard GitHub issues should exist.

⚠️ NOTE: These issues exist, but have not been completed. Please continue with the code review anyway, and we will be addressing them in parallel.

Build and Run Checks

If any of these items fail, pause code review.

Memory Leaks

Performance

Usability

Internationalization

  "material.water": {
    "value": "Water"
  },
  "material.wood": {
    "value": "Wood"
  },
  "shape.block": {
    "value": "Block"
  },
  "shape.cone": {
    "value": "Cone"
  },

Nested substructure is not yet fully supported.

Repository Structure

Coding Conventions

TypeScript Conventions

Math Libraries

IE11

Organization, Readability, and Maintainability

Accessibility

Not supported.

PhET-iO

This section may be omitted if the sim has not been instrumented for PhET-iO, but is likely good to glance at no matter.

marlitas commented 1 year ago

I've completed my review outside of two bullets which I have questions about, plus an additional clarifying question:

  • [ ] PhET-iO instantiates different objects and wires up listeners that are not present in the PhET-branded simulation. It needs to be tested separately for memory leaks. To help isolate the nature of the memory leak, this test should be run separately from the PhET brand memory leak test. Test with a colorized Data Stream, and Studio (easily accessed from phetmarks). Compare to testing results done by the responsible developer and previous releases.

This is talking about a memory leak test but I saw that memory leaks were outside the scope of this code review, and were being actively worked on in other issues. Is this bullet included in that or should I test for memory leaks in studio?

  • [ ] Are your IOType state methods violating the API of the core type by accessing private fields?

I don't know what this means. Is there another way to access private fields through phet-io?

  • [ ] Like JSON, keys for undefined values are omitted when serializing objects across frames. Consider this when determining whether toStateObject should use null or undefined values.

I didn't see any null or undefined values in the toStateObject usages here, but even if I did I wouldn't know what to consider or how this might impact the sim.

Other than that from my perspective the sim looks really clean and well architectured. I added // REVIEW comments which can be tracked in the commits here, and also made minor grammatical or whitespace changes. Any other issues opened during this review have been linked to this issue and labeled dev:code-review

Over to @pixelzoom and @veillette

veillette commented 1 year ago

Thanks @marlitas for all work.

pixelzoom commented 1 year ago

Thanks @marlitas!

To answer your questions:

  • [ ] PhET-iO instantiates different objects and wires up listeners that are not present in the PhET-branded simulation. It needs to be tested separately for memory leaks. ...

This is talking about a memory leak test but I saw that memory leaks were outside the scope of this code review, and were being actively worked on in other issues. Is this bullet included in that or should I test for memory leaks in studio?

You can skip it. I should have changed this item to strikethrough text. We're actively working on it in https://github.com/phetsims/calculus-grapher/issues/265.

  • [ ] Are your IOType state methods violating the API of the core type by accessing private fields?

I don't know what this means. Is there another way to access private fields through phet-io?

Not an issue in TypeScript code, since tsc will complain loudly if you access a private field.

  • [ ] Like JSON, keys for undefined values are omitted when serializing objects across frames. Consider this when determining whether toStateObject should use null or undefined values.

I didn't see any null or undefined values in the toStateObject usages here, but even if I did I wouldn't know what to consider or how this might impact the sim.

The gist of this is that PhET serializes to/from JSON, and using undefined as a value in JSON is to be avoided. And we have indeed avoid that in this sim.

pixelzoom commented 1 year ago

All outstanding issues are being tracked in their own GitHub issues, so I'm going to go ahead and close this issue.

Thanks again @marlitas for the speedy review!