Good Practice of Programming - Team1923/Stronghold_2016 GitHub Wiki

The Good Practice of Programming:

  • To name a class, we capitalized the first letter and use camel case. The name describes what does this script do.
    1. prefix: “Auton”, “Teleop”
    2. postfix :“Command”, “Subsystem”
  • To name a method, we use lowercase for the first letter and camel case.
    1. e.g. getSpeed(); setTimeOut(); init();
  • To name a variable, we use lowercase for the first letter and camel case.
    1. e.g. speed, allianceNumber, gyro
  • Spacing / The rule of thumbs
    • One line of space between each method / constructor
public void getSpeed(){
   return speed;
}

public void getDistance(){
   return distance;
}
  • One variable per line. float speed, distance;
float speed;
float distance;
  • Use tab to organize the script
  • Leave space between assignor and operator. speed=2;
speed = 2;