phetsims / build-a-nucleus

"Build a Nucleus" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 5 forks source link

Pass in only addParticle() and position from ParticleAtom to dragEndedListener() in BANScreenView #150

Closed Luisav1 closed 1 year ago

Luisav1 commented 1 year ago

From #112. Currently passing in entire atom.

zepumph commented 1 year ago

I feel the same way here as I do in https://github.com/phetsims/build-a-nucleus/issues/152#issuecomment-1684419690:

This is a reasonable thought, but I kinda think it is more trouble than it is worth. Much of the worry in regards to "only pass in what you need" is for class constructors, where by passing in a whole model class, you are more likely to use other stuff that further breaks encapsulation and muddy the exact purpose of your class. Here, it seems totally fine to provide a particleAtom to a function for extracting one of its particles.

Especially because here it means passing in two items instead of the one ParticleAtom.

Let me know if you'd like to discuss more.

zepumph commented 1 year ago

@Luisav1 and I discussed and are in agreement.