Difference between revisions of "Team Mighty Morphin Coding Rangers - OOP344"
m (moved Team Coding Rangers - OOP344 to Team Mighty Morphin Coding Rangers - OOP344: Incorrect Name) |
m |
||
Line 17: | Line 17: | ||
<ul> | <ul> | ||
<li>use single letters (like i, j, a, or v) for counters only; </li> | <li>use single letters (like i, j, a, or v) for counters only; </li> | ||
− | + | <li>assign the variable a name that best describes what it is used for (but please don't make it too long);</li> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<li>and separate words with caps. | <li>and separate words with caps. | ||
<br/> Eg. no<b>O</b>f<b>O</b>rders, not no<b>o</b>f<b>o</b>rders | <br/> Eg. no<b>O</b>f<b>O</b>rders, not no<b>o</b>f<b>o</b>rders | ||
Line 53: | Line 45: | ||
<li>Only <code>main ()</code> will start at column 1. Tab every block of code four spaces over.</li> | <li>Only <code>main ()</code> will start at column 1. Tab every block of code four spaces over.</li> | ||
− | <li> | + | <li>one variable per type {better off per line} even if it's the same type (<b>no</b> using commas to share a variable during declaration);</li> |
+ | |||
+ | <code> | ||
+ | Eg. correct int i; | ||
+ | int j; | ||
+ | int k; | ||
+ | |||
+ | Eg. wrong int i,j,k; | ||
+ | Eg. so/so int i; int j; int k; | ||
+ | </code> | ||
<li>Include an empty line after the declaration of variables (see above example).</li> | <li>Include an empty line after the declaration of variables (see above example).</li> |
Revision as of 10:48, 27 January 2010
OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources
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 /* ... */.
- At the top of every file, include your name, the filename, and the purpose of the file.
- Comment on what a function is supposed to do before the function definition.
- 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 variable a name that best describes what it is used for (but please don't make it too long);
- and separate words with caps.
Eg. noOfOrders, not nooforders
- When naming a function, name it according to what it is supposed to do.
Eg.void updateDelivery, int setInitialValue
, notvoid Deliveries, int InitialValues
- Class names must begin with a capital letter
- Type four (4) spaces over for every block of code. (This is as opposed to tabbing.) For example:
main () {
int x; //Notice the four spaces over
int y;
for (x = 0, y = 10; x < 10 && y > 0; x++, y++) {
printf("x is %d, y is %d\n", x, y);
printf("The sum of x and y is %d\n", x + y);
if (x == 5)
printf("We've reached the halfway point!\n"); //Moved four spaces over }
printf("Hello, world!");
}
main ()
will start at column 1. Tab every block of code four spaces over.
Eg. correct int i; int j; int k; Eg. wrong int i,j,k; Eg. so/so int i; int j; int k;
Eg.
i = 0;
, not i=0;
while, for, if, else,
put a space after the keyword and the expression following it.
Eg.
if (x == 0)
is correct; if(x == 0)
is incorrectEg. CORRECT:
int setSafeEmptyState {
...
}
INCORRECT:
int setSafeEmptyState
{
...
}
Member list
Last Name | Name | Seneca Username | Section | Blog Url | IRC Nick | SVN ID | My Contributions | Role |
---|---|---|---|---|---|---|---|---|
Chau | Sunny | schau5 | B | Blog | ScsC | TBA | Contributions | Team Contact |
Cheung | Christopher | cgcheung | B | http://rocketpants.blog.ca/ | Rocketpants | n/a | Contributions | Team Contact |
Huang | Dachuan | dhuang | B | http://hdc23.wordpress.com/ | Da_Truth | n/a | Contributions | Team Contact |
John-Sandy | Anastasia | ajohn-sandy | B | http://anastasiasaurus.blogspot.com | annieJS | n/a | Contributions | Team Contact |
Oberes | Donna | daoberes | B | Blog | Donna_Oberes | n/a | Contributions | Team Contact |
Wang | Cong | Cwang84 | A | http://wangcong422.blogspot.com/ | cwang84 | n/a | Contributions | Team Contact |
Wang | Shengwei | swang94 | A | http://shengwei-seneca.blogspot.com/ | Shengwei | n/a | Contributions | Team Contact |
Xue | Yong | yxue11 | B? | http://yxue11.blogspot.com/ | yxue11 | n/a | Contributions | Team Contact |
~ | ~ | e-mail all @ once | ~ | ~ | ~ | ~ | ~ | ~ |