Home Conventions Setting Up a Programming Environment Mac

Space Cookies Team 1868
Programming Resources

Coding Conventions

Naming

Camel case is how we name variables, because it makes names easier to read. The first letter is lower case, and the first letter of every word after is uppercase.

Please do not create excessively long names, but also not too short to be vague.

Enums all start with k, like kIntakeUp and kIntakeDown instead of intakeUp and intakeDown.

Class variables all start with a _, and are defined in the .h file. For example, _leftJoy and not leftJoy.

Constants: keep in all capital letters

Brackets and Indentation

An extra enter is not needed before the opening bracket, this just makes the code needlessly longer. Add another tab within every bracket (if adding an if statement in an if statement, the inside of the second if statement should have 2 tabs).


        if (true) { //correct
            //insert code here;
        }

        if (true) //wrong
        {
            //insert code here;
        }
        

Miscellaneous

For loops: use i as the name of the counter variable, then j then k afterwards, etc.

Spacing: put spaces between operators