Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert simulations to ES6/class #1050

Closed
9 tasks done
samreid opened this issue Oct 15, 2020 · 16 comments
Closed
9 tasks done

Convert simulations to ES6/class #1050

samreid opened this issue Oct 15, 2020 · 16 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Oct 15, 2020

Similarly to #1044, we would now like to investigate converting simulation repos to use ES6/class/arrow functions/this instead of self/const, etc. @jonathanolson demonstrated a utility he developed to assist in this task. @ariel-phet asked me to create a checklist issue in the tasks repo to track each developer porting one simulation forward by Thursday Oct 22.

@ariel-phet can you please review the developer list? I'm not sure if everyone should be on there, or if I've missed someone. Also, I discovered GitHub issues have a max of 10 assignees, so I was unable to assign @shreyas-g-ucb.

UPDATE: I finished a sim, so I unassigned myself, and that made room for @shreyas-g-ucb.

UPDATE: For the record, at the time of this issue creation, we had 3119 occurrences of class ... extends and 887 occurrences of inherit(

EDIT: Saurabh and Brandon removed

@samreid
Copy link
Member Author

samreid commented Oct 15, 2020

I used the Sublime script to convert fraction-comparison, and it went very smoothly. There was one occurrence of this before super, and I manually fixed some whitespace near the constructor jsdoc (added a blank line before it). I manually converted a few var to const, and everything else looked great, nice work @jonathanolson.

@samreid samreid assigned shreyas-g-ucb and unassigned samreid Oct 15, 2020
samreid added a commit to phetsims/john-travoltage that referenced this issue Oct 15, 2020
@samreid
Copy link
Member Author

samreid commented Oct 16, 2020

I finished my remaining sim. We are down to 868 occurrences of inherit( .

@zepumph
Copy link
Member

zepumph commented Oct 16, 2020

each developer porting one simulation forward by Thursday Oct 22.

With this timeline, I would like to promote priority.

@mattpen
Copy link

mattpen commented Oct 16, 2020

I removed Shreyas because he is not currently working for us.

I haven't worked on the sim development since mid-2016. Is there a quick guide to what needs to be done for me to complete work on a sim? If not, it may be more efficient to remove me from this list.

@samreid
Copy link
Member Author

samreid commented Oct 16, 2020

I noted that @mattpen wasn't listed in https://github.com/phetsims/phet-info/blob/master/sim-info/responsible_dev.md, so I'm going to check him off and unassign. Sorry for the confusion!

@ariel-phet
Copy link

Marking to check in for dev meeting

@jbphet
Copy link

jbphet commented Oct 21, 2020

I've ported Faraday's Law using the script. The script is awesome, and I think I may use it to port a sim or two a week until mine are all done. Thanks @jonathanolson. Unassigning myself.

@jbphet jbphet removed their assignment Oct 21, 2020
@Denz1994
Copy link

Similar story to @zepumph's comment above.

I ended up using Sublime to avoid any potential Intellij compatibility issues. Masses and Springs converted nicely. Capacitor-Lab-Basics still required additional workarounds due to using this before the super call but that is a sim specific implementation detail and not related to @jonathanolson's tool. Great tool overall.

@jessegreenberg
Copy link

I used the plugin on trig-tour using Sublime Text 3, it was great and saved a ton of time. I had to do very few things manually, they were

  • Required visibility annotations that became eslint errors after the switch, there is no way to automate that.
  • It didn't add a space between the class declaration and constructor documentation.
  • Occasionally it didn't change SuperType.call -> super. I am pretty sure it missed the places where there was a comment above the SuperType.call.

@jessegreenberg jessegreenberg removed their assignment Oct 22, 2020
@mattpen
Copy link

mattpen commented Oct 22, 2020

@ariel-phet will create a chip-away issue to apply the change to all sims.

@jonathanolson will try to address some of the above comments.

@zepumph
Copy link
Member

zepumph commented Oct 22, 2020

I was able to have success converting all js files recursively in a directory using this script after you cd to that dir (like js/ in a sim repo). Running on git bash on windows. You can just change the path to the classify script as needed.

find ./ -maxdepth 100 -iname '*.js' -type f -exec python /c/Users/MyUser/AppData/Roaming/Sublime\ Text\ 3/Packages/phet-sublime-plugin/classify.py {} \;

@chrisklus chrisklus self-assigned this Oct 23, 2020
chrisklus added a commit to phetsims/plinko-probability that referenced this issue Oct 27, 2020
Denz1994 added a commit to phetsims/capacitor-lab-basics that referenced this issue Oct 27, 2020
chrisklus added a commit to phetsims/color-vision that referenced this issue Oct 28, 2020
@chrisklus
Copy link

I converted Plinko Probability and Color Vision above. Thanks @jonathanolson! And thanks @zepumph for the recursive suggestion in #1050 (comment) - that worked very well for me.

@chrisklus chrisklus removed their assignment Oct 28, 2020
@zepumph
Copy link
Member

zepumph commented Nov 12, 2020

I think all that is left in this issue are the improvements to classify.py, like #1050 (comment)

samreid added a commit to phetsims/greenhouse-effect that referenced this issue Dec 3, 2020
samreid added a commit to phetsims/forces-and-motion-basics that referenced this issue Dec 3, 2020
@jonathanolson
Copy link
Contributor

No need to handle the python bits, I'm not using them in Sublime anymore. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests