Changes

Jump to: navigation, search

Team Mighty Morphin Coding Rangers - OOP344

860 bytes added, 22:45, 22 January 2010
Coding Style - updated the coding style (by DO)
<ul>
<li>Comment as much as you can using /* ... */.</li> <ul> <li>At the top of every file, include your name, the filename, and the purpose of the file.</li>  <li>Comment on what a function is supposed to do before the function definition.</li> </ul>
<li>Change to newline once you reach <b>column 80</b>. Nothing to be typed beyond column 80!</li>
<li>When naming variables,
<ul>
<li>use single letters (like i, j, a, or v) for counters only. ; </li> <li>assign the variable a name that best describes what a variable it is used for (but please don't make it too long);</li> <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
</ul>
</li>
<li>TabbingWhen naming a function, name it according to what it is supposed to do. <br />Eg. <code>void updateDelivery, int setInitialValue</code>, not <code>void Deliveries, int InitialValues</code></li>  <li>Class names must begin with a capital letter</Spacingli>  <li>Tab/space two (2) spaces for every block of code. For example: As most </li><code> main () { <br/> int x, y; <br/> for (x = 0, y = 10; x < 10 && y > 0; x++, y++) { <br/> printf("x is %d, y is %d\n", x, y); <br/> printf("The sum of us have decided to use vix and y is %d\n", we have determined that x + y); <bbr/>TABBING 2 SPACES if (x == 5) <br/b> will be printf("We've reached the norm.halfway point!\n"); } <br/> printf("Hello, world!"); <br/> } <br/></code>
<li>Only <code>main ()</code> will start at column 1. Tab everything else every block of code two spaces over.</li>
<li>When using operators, make sure to have a space between the operands and the operator for readability.
<br/>Eg. <code>i = 0;</code>, not <code>i=0;</code></li>
<li>For keywords such as <code>while, for, if, else, </code> put a space after the keyword and the expression following it. <br/> Eg. if <code>if (x==0)</code> is correct, not ; <code>if(x==0)</code>is incorrect</li>
<li>When using brackets, put the opening bracket on the same line as the function or expression that opens it. <br/> Eg. <b>CORRECT: </b> <br/>Eg. <br/code>int setSafeEmptyState { <br/> ... <br/> } </code> <br/>} is correct <b>INCORRECT: </b> <br/> <code>int setSafeEmptyState <br/>{ { <br/> ...<br/> } </code> <br/>} is incorrect
</li>
 
</ul>
1
edit

Navigation menu