phetsims / fourier-making-waves

"Fourier: Making Waves" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

Code review #165

Closed pixelzoom closed 3 years ago

pixelzoom commented 3 years ago

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

GitHub Issues

The following standard GitHub issues should exist. If these issues are missing, or have not been completed, pause code review until the issues have been created and addressed by the responsible dev.

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

This section deals with PhET coding conventions. You do not need to exhaustively check every item in this section, nor do you necessarily need to check these items one at a time. The goal is to determine whether the code generally meets PhET standards.

For example, both of these are acceptable:

Property.multilink(
  [ styleProperty, activeProperty, colorProperty ],
  ( style, active, color ) => {
    // some algorithm that uses style and active
} );

Property.multilink(
  [ styleProperty, activeProperty, colorProperty ],
  ( style, active ) => {
    // some algorithm that uses style and active
} );

This is not acceptable, because the 3rd parameter is incorrect.

Property.multilink(
  [ styleProperty, activeProperty, colorProperty ],
  ( style, active, lineWidth ) => {
    // some algorithm that uses style and active
} );

Documentation

This section deals with PhET documentation conventions. You do not need to exhaustively check every item in this section, nor do you necessarily need to check these items one at a time. The goal is to determine whether the code generally meets PhET standards.

/**
 * Updates this node.
 * @abstract
 * @protected
 */
 update() {
   throw new Error( 'update must be implemented by subclass' );
 }

Type Expressions

This section deals with PhET conventions for type expressions. You do not need to exhaustively check every item in this section, nor do you necessarily need to check these items one at a time. The goal is to determine whether the code generally meets PhET standards.

Visibility Annotations

This section deals with PhET conventions for visibility annotations. You do not need to exhaustively check every item in this section, nor do you necessarily need to check these items one at a time. The goal is to determine whether the code generally meets PhET standards.

Because JavaScript lacks visibility modifiers (public, protected, private), PhET uses JSdoc visibility annotations to document the intent of the programmer, and define the public API. Visibility annotations are required for anything that JavaScript makes public. Information about these annotations can be found here. (Note that other documentation systems like the Google Closure Compiler use slightly different syntax in some cases. Where there are differences, JSDoc is authoritative. For example, use Array.<Object> or Object[] instead of Array<Object>). PhET guidelines for visibility annotations are as follows:

Math Libraries

IE11

Organization, Readability, and Maintainability

Accessibility

This section may be omitted if the sim has not been instrumented with accessibility features. Accessibility includes various features, not all are always include. Ignore sections that do not apply.

General

Alternative Input

Interactive Description

N/A

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.

pixelzoom commented 3 years ago

This sim is ready for code review. All code has been cleaned up, and I completed a "self code review" in https://github.com/phetsims/fourier-making-waves/issues/163.

This is a big sim, ~15,000 lines of code. It makes heavy use of bamboo charts, and it has a relatively involved model. It will take some time to review. Definitely start by reading model.md and implementation-notes.md.

In order to stay on track for 9/30/21 publication, this code review needs to be completed no later than 9/13/2021.

@kathy-phet @arouinfar please assign a reviewer.

kathy-phet commented 3 years ago

@jonathanolson will do the Fourier code review, and also simultaneously be effectively code reviewing - or at least another perspective and eyes on - Bamboo to some degree.

@pixelzoom EDIT:
Also in Slack on 9/1:

Kathy Perkins 2:52 PM @jonathanolson - Here is the code review issue for Fourier! Thanks! @pixelzoom is back on 9/13, so goal is completion by then. https://github.com/phetsims/fourier-making-waves/issues/165

Jonathan Olson 2:54 PM Sounds good, thanks!

Chris Malley 3:38 PM A quick update… Fourier sailed through dev-lite testing — testing is done, with a couple of quick things to address. So full dev test can start as soon as we’re done with code review, and I’ll have time to address code-review issues while I’m on vacation. So while 9/13 is the goal for completing code review, sooner is better, and will increase the chances that we can hit 9/30 production deploy.

Jonathan Olson 3:38 PM About an hour ago Density is blocked on responses, so I did start the review

pixelzoom commented 3 years ago

@jonathanolson said in Slack:

Finished the initial code inspection, committed REVIEW comments and minor improvements tagged to https://github.com/phetsims/fourier-making-waves/issues/165. I'll be going through the rest of the checklist, and have some general notes too. Very nice code, pleasure to read!

Thanks. I've addressed all of the REVIEW comments, see commits above, feel free to review. A few were promoted to GitHub issues, linked above.

Let me know when you've completed the rest of the checklist.

pixelzoom commented 3 years ago

@jonathanolson and I discussed a few "polish" issues over Zoom, and I summarized them in #176.

@jonathanolson will continue working on the remaining items in the CRC checklist, so that we can proceed with dev testing.

jonathanolson commented 3 years ago

image

Max-width on second string "Choose your level"?

pixelzoom commented 3 years ago

I did have a maxWidth set for "Choose Your Level", but it was commented out. Looks like an unintentional change in https://github.com/phetsims/fourier-making-waves/commit/3a3b1f8850a05d40f39d0836239f399e85db7c07. Fixed in the above commit.

jonathanolson commented 3 years ago

Otherwise review all done, looking great!

pixelzoom commented 3 years ago
  • [ ] Performance is a bit slow on Wave Packet (pi/4 spacing), is it still similar to when performance was signed off?

@jonathanolson Were you testing performance with a built version? Performance of the unbuilt version is quite a bit slower, due to assertions. If you were testing with a built version, what was your test platform?

Nothing significant has changed since performance sign-off in https://github.com/phetsims/fourier-making-waves/issues/131.

Yes, I realize that, thanks. In this case, clockFaceNode is instantiated before super is called, so this.visibleProperty does not exist. So I chose to call clockFaceNode.setVisibleProperty rather than move instantiation after the constructor and call addChild.

jonathanolson commented 3 years ago

I was testing performance with a built version. Sounds like this issue can be closed then?

pixelzoom commented 3 years ago

Since you report that it was a built version, I'm going to reopen #131 (performance sign-off) to have @arouinfar explicitly check the Wave Packet screen with pi/4 spacing.

And yes, this issue can be closed.