Team Mighty Morphin Coding Rangers - OOP344

From CDOT Wiki
Revision as of 19:15, 21 January 2010 by Daoberes (talk | contribs) (Updated page to include coding style of the team)
Jump to: navigation, search

Coding Style

The Coding Rangers had their first somewhat informal meeting on Jan. 21 to determine a uniform coding style. They came up with the following:

  • Comment as much as you can using /* ... */.
  • Change to newline once you reach column 80. Nothing to be typed beyond column 80!
  • When naming variables,
    • use single letters (like i, j, a, or v) for counters only.
    • assign the name that best describes what a variable is used for (but please don't make it too long)
    • separate words with caps.
      Eg. noOfOrders, not nooforders
  • Tabbing/Spacing: As most of us have decided to use vi, we have determined that TABBING 2 SPACES will be the norm.
  • Only main () will start at column 1. Tab everything else two spaces over
  • When using operators, make sure to have a space between the operands and the operator for readability.
    Eg. i = 0;, not i=0;
  • For keywords such as while, for, if, else, put a space after the keyword and the expression following it.
    Eg. if (x==0) is correct, not if(x==0)
  • When using brackets, put the opening bracket on the same line as the function or expression that opens it.
    Eg.
    int setSafeEmptyState {
    ...
    } is correct
    int setSafeEmptyState
    {
    ...
    } is incorrect