Closed jbphet closed 1 year ago
According to the GitHub history, the TODO in ParticleAtom
was originally added by @zepumph, so I'm going to assign this to him to address, prioritize, reassign, or defer as he sees fit.
At immediate glance, it looks like these DerivedProperties were added just because we didn't yet have OberservableArray's lengthProperty instrumented, my guess is that we can delete these intermediary instrumented Properties.
Okay, the derived properties for the particle counts have now been removed. I considered removing the Properties such as protonCountProperty
from the API and requiring clients of this class to instead use, for example, protons.length
, but this would have touched a lot of files and the API seems nicer to me with these Properties in place, so I left them there, and they are now direct read-only references to the lengthProperty
values from the observable arrays that contain the particles.
I regression tested Build an Atom and Build a Nucleus, and I tested setting state in the Build an Atom PhET-iO state wrapper, and everything seemed fine. @zepumph - I don't know if more regression testing of the PhET-iO behavior is warranted. Is it? If not, I think this can be closed.
All is good thanks!
In the
ParticleAtom
class there are derived properties that were created in support of phet-io that are basically just the length values of theObservableArray
for that particle type. These should be modified, if possible, to simply use the 'length' property.See https://github.com/phetsims/axon/issues/149 for more about length property and phet-io.
This issue was logged as part of the effort to make sure all TODO items have associated issues, see https://github.com/phetsims/tasks/issues/1017.