This is a living doc. As we decide on more principles and rules we will open issues, discuss the changes and improve.
These our are guiding principles. If anything goes against these principles it should be challenged.
-
Code should be descriptive
//good function turnToPointsIntoAnSVGLine(pointOne, pointTwo){} //ok function pointsToLine(pointOne, pointTwo){} //bad function makeLine(a, b){} /*************************/ //good var usersName = "Rami"; //ok var name = "Yalcin"; //bad var n = "Matthew"; /*************************/ //good var scoreIsGreaterThan25 = score > 25; var scoreIsLessThan50 = score < 50; if(scoreIsGreaterThan25 && scoreIsLessThan50){} //bad if((score > 25) && (score < 50)){}
-
Functions should
do
a singlething
//good var game = { /* some game object */ }; var user = { score: 10, positionInGame: 3, givePoint: function(){ user.score++; } } //bad var game = { /* some game object */ }; var user = { score: 10, positionInGame: 3, givePoint: function(){ user.score++; game.rankUser(user); } }