phetsims / mean-share-and-balance

"Mean: Share and Balance" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 1 forks source link

Pull functions out of the FairShareModel constructor #300

Closed jessegreenberg closed 1 week ago

jessegreenberg commented 2 weeks ago

This is a stylistic thing, but I think smaller constructors are easier to understand. Pulling handleModeChange and handleNumberOfSnacksChanged into instance methods (>200 lines) would (IMO) make the functions and constructor easier to understand. This is also the largest file in the sim (565 lines).

Feel free to close this one if you disagree.

marlitas commented 1 week ago

I was wondering about that, so I'm glad you brought it up. I agree. I moved them out above. I tried to read through and see if there are any other ways to consolidate, but those really do need to be that big. @jessegreenberg, let me know if that feels better. If so, go ahead and close.

jessegreenberg commented 1 week ago

Yes, looks nice! Thanks.