Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

socialtables/javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to do Javascript at Social Tables

This is a living doc. As we decide on more principles and rules we will open issues, discuss the changes and improve.

Principles

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 single thing

     //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);
     	}
     }

General Rules

Reading

Releases

No releases published

Packages

No packages published