Closed ghost closed 10 years ago
Tip: try http://jsbeautifier.org/ and/or JSLint.
I put the code through http://jsbeautifier.org/ and, in the name of uniformity, changed variable names and function names to camelCase
.
Personally I prefer snake_case.
But ... the main "disadvantage" of snake_case is that we are using 3rd party libraries which have functions and variables that are in camelCase. Then we have to use two different case-strategies, which probably can be a bit confusing.
Exaclty. Me, I prefer snake_case myself, but all the built-in names in JS and most names in popular libs are camelCase, so we should bite the bullet, and man up, and camelCase ourselves.
Friendly tip: your JS will benefit significantly from "JavaScript: the good parts." You don't have to follow it word by word, of course, but it improves style and readability.
Hi Eugene! I actually read it. Are we still talking formatting or do you see something in traceit.js that's not a good JS code practice?
thank you! Yuna
On Thursday, May 29, 2014 12:12 AM, Eugene Chernikov notifications@github.com wrote:
Friendly tip: your JS will benefit significantly from "JavaScript: the good parts." You don't have to follow it word by word, of course, but it improves style and readability. — Reply to this email directly or view it on GitHub.
Code (imho) needs more comments explaining algorythms and less two-letter variable names for code self-documenting. The rest of your code is reasonably good, no horrible antipatterns.
To improve readablity and facilitate contributions code needs to be cleaned up. Unified coding style also helps, choose one and stick to it. Examples:
// line commens
instead of/* block comments */
;camelCase
orsnake_case
, not both (camelCase
is actually preferred);new
);Space before argument list in function declaration:
No space between function name when invoking:
Conditionals and cycles generally need spaces for readability:
Commented code generally concidered unnecessary.