Closed ariel-phet closed 7 years ago
Hi @AshrafSharf, @jonathanolson and I are thankful for the work you have done on this sim and very excited to get it published. One of the next steps will be to prepare the code for code review. Can you please review the code review checklist above, address any of the items that you can and ask questions about anything that is unclear? Please let me and @jonathanolson know when you are ready to discuss further.
on stringTest=double. The screen looks like this. Shall I just make the font size a function of number of characters. Would that be enough?
Added some review issues after a brief (very incomplete) code review. Will plan to discuss when working with @AshrafSharf (but feel free to fix issues beforehand).
(Will do a full code review at a later undermined point).
Make sure the string keys are all perfect, they are difficult to change after 1.0.0 is published. Strings keys should generally match the values, such as {binaryProbability: "Binary Probability"}. Screen names should use screen.screenName instead of camelcase. Message patterns and long paragraphs will also use a different pattern.
@samreid, is this style of key allowable:
"game.info.level1":{
"value":"Add single digit numbers to get sums of 10 and under."
},
"screen.explore":{
"value":"Explore"
},
"next":{
"value":"Next"
},
Here are some key-value pairs and my recommendations:
{
"make-a-ten.title": { // perfect
"value": "Make a Ten"
},
"screen.adding":{ // looks great
"value":"Adding"
},
"screen.explore":{ // looks great
"value":"Explore"
},
"screen.game":{ // looks great
"value":"Game"
},
"make-a-ten.hide.total":{ // Why is this prefixed with "make-a-ten"? It should be hideTotal
"value":"Hide Total"
},
"make-a-ten.keypad.submit":{ // Why is this prefixed with "make-a-ten"? Just use "submit"
"value":"Submit"
},
"next":{ // good
"value":"Next"
},
"game.info.levelX":{ // See image below:
"value":"Level {0}"
},
"game.info.level1":{ // How about level1Description?
"value":"Add single digit numbers to get sums of 10 and under."
},
"game.info.level2":{ // see level 1
"value":"Add 9 to a single digit number to get sums between 10 and 20."
},
"game.info.level3":{
"value":"Add single digit numbers to get sums between 10 and 20."
},
"game.info.level4":{
"value":"Add with multiples of 10."
},
"game.info.level5":{
"value":"Add double digit numbers and single digit numbers."
},
"game.info.level6":{
"value":"Add double digit numbers with sums under 100."
},
"game.info.level7":{
"value":"Add double digit numbers with sums over 100."
},
"game.info.level8":{
"value":"Add single digit numbers to triple digit numbers."
},
"game.info.level9":{
"value":"Add hundreds and multiples of ten."
},
"game.info.level10":{
"value":"Add triple digit numbers."
}
}
For patterns, we inherited this from our Java sims, even though it is ugly at least it would be consistent:
I think Arithmetic has a level pattern like the one you need.
"pattern.level.0levelNumber": {
"value": "Level {0}"
},
Additionally, is phet-io instrumention required now, as it's on the checklist?
I committed a change (see above) that clarifies that the PhET-iO checklist is only to be used for simulations that are already instrumented or should be instrumented.
Everything except the assets (https://github.com/phetsims/make-a-ten/issues/250), performance (https://github.com/phetsims/make-a-ten/issues/251) and credits (https://github.com/phetsims/make-a-ten/issues/249) has been handled here.
Closing, as those are already in stand-alone issues.
NOTE! Prior to doing a code review, copy this checklist to a GitHub issue for the repository being reviewed.
PhET code-review checklist
Build and Run Checks
Internationalization
{binaryProbability: "Binary Probability"}
. Screen names should usescreen.screenName
instead of camelcase. Message patterns and long paragraphs will also use a different pattern.Repository structure
[x] Are all required files and directories present?
For a sim repository named “my-repo”, the general structure should look like this (where assets/, audio/ or images/ may be omitted if the sim doesn’t have those types of assets).
For a common-code repository, the structure is similar, but some of the files and directories may not be present if the repo doesn’t have audio, images, strings, or a demo application.
[x] Is the js/ directory properly structured?
All JavaScript source should be in the js/ directory. There should be a subdirectory for each screen (this also applies for single-screen sims). For a multi-screen sim, code shared by 2 or more screens should be in a js/common/ subdirectory. Model and view code should be in model/ and view/ subdirectories for each screen and common/. For example, for a sim with screens “Introduction” and “Custom”, the general directory structure should look like this:
grunt build
.grunt published-README
orgrunt unpublished-README
?chipper/js/grunt/Gruntfile.js
?Coding conventions
Documentation
Common Errors
Math.round
used wheredot.Util.roundSymmetric
should be used? Math.round does not treat positive and negative numbers symmetrically, see https://github.com/phetsims/dot/issues/35#issuecomment-113587879toFixed
used wheredot.Util.toFixed
ordot.Util.toFixedNumber
should be used? JavaScript'stoFixed
is notoriously buggy, behavior differs depending on browser, because the spec doesn't specify whether to round or floor.phet.joist.random
, and all doing so after modules are declared (non-statically)? For instance, the following methods (and perhaps others) should not be used:Math.random
_.shuffle
_.sample
_.random
new Random()
Organization, Readability, Maintainability
Performance, Usability
dt
capped appropriately? Try switching applications or browser tabs, then switch back. Did the model take one big/long/awkward step forward? If so,dt
may need to be capped. Example fromfaradays-law.FaradaysLawModel
:Memory Leaks
Property.link
is accompanied byProperty.unlink
.PropertySet.link
is accompanied byPropertySet.unlink
.DerivedProperty
is accompanied bydispose
.Multilink
is accompanied bydispose
.Events.on
is accompanied byEvents.off
.Emitter.addListener
is accompanied byEmitter.removeListener
.Node.addEventListener
is accompanied byNode.removeEventListener
Node.on
is accompanied byNode.off
tandem.addInstance
is accompanied bytandem.removeInstance
.dispose
function have one?PhET-iO