phetsims / density-buoyancy-common

Common code for the Density and Buoyancy simulations
GNU General Public License v3.0
0 stars 2 forks source link

Code Review #123

Closed samreid closed 3 months ago

samreid commented 7 months ago

To familiarize myself better with the codebase, and better prepare for code review, I'll take a look around.

UPDATE:

To begin a code review, the responsible developer should:


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

Specific Instructions

There are 10 screens across 3 sims. We are publishing with keyboard support but without sonification or interactive description. This simulation uses 2 third party engines. Three.js for 3d rendering and p2 for physics. Review mobius usages as necessary.

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

See also https://github.com/phetsims/density-buoyancy-common/issues/168

Performance

Usability

Internationalization

Repository Structure

UPDATE: We discussed this in https://github.com/phetsims/density-buoyancy-common/issues/125 and approved a variation

Coding Conventions

TypeScript Conventions

Math Libraries

IE11

Organization, Readability, and Maintainability

class MyClass {
  public constructor( tickMarksVisibleProperty: Property<boolean>,
                      model: Pick<IntroModel, 'changeWaterLevel'>, // <-- Note the call site can pass the whole model, but we declare we will only use this part of it
                      waterCup: WaterCup, modelViewTransform: ModelViewTransform2,
                      providedOptions?: WaterCup3DNodeOptions ) {}
}
cd {{repo}}/js ; wc -l `find . -name "*.ts" -print` | sort

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

Section deleted because Interactive Description is not supported for this publication.

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.

samreid commented 4 months ago

My "note to self" notes to highlight as I continue through the codebase:

To keep in mind as reading through

I'm halfway through common/model. UPDATE up to common/view

samreid commented 4 months ago

Code review is complete. I feel the architecture and overall setup is in good shape. I've opened side issues or TODO comments for recommendations for further improvements.

One difficulty I have in navigating the code is that it is difficult to map from the screen to the code and back. For instance, here is a panel in one of the buoyancy screens:

image

Since this is an untitled control, it is difficult to know where it lies in the files, and vice versa (looking at the files, difficult to know it is referring to that panel). I'm not sure how to solve that for this case, but it does seem to be less of a problem for the titled panels or titled accordion boxes. Just writing this down as a potential topic to keep in mind for future designs--nothing to do about it at the moment.

Of the remaining TODOs listed for this issue, some are relatively minor and can be addressed here. Others will likely want to move into a dedicated side issue. Some are questions, and some we may decide are not worth the effort. For next steps, can @AgustinVallejo and @zepumph please review the TODOs that reference this issue and take next steps?

AgustinVallejo commented 4 months ago

We moved all the remaining TODOs into https://github.com/phetsims/density-buoyancy-common/issues/317. Thank you very much @samreid for your thorough review!! Closing

phet-dev commented 3 months ago

Reopening because there is a TODO marked for this issue.

AgustinVallejo commented 3 months ago

Reopening because there is a TODO marked for this issue.

Ironic.

Closing again