Difference between revisions of "Team Mighty Morphin Coding Rangers - OOP344"

From CDOT Wiki
Jump to: navigation, search
m (Added "Issues" subheading)
(Coding Style)
Line 2: Line 2:
  
 
__TOC__
 
__TOC__
 +
 +
 +
== SVN Repository ==
 +
 +
<big>
 +
oop344_101rep4
 +
</big>
  
 
== Coding Style ==
 
== 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:  
+
The Coding Rangers had their first somewhat informal meeting on Jan. 21 to determine a uniform coding style. They came up with the following:
  
 
<ul>
 
<ul>
  <li>Comment as much as you can using /* ... */. </li>
+
<li>Comment as much as you can using /* ... */. </li>
  <ul>
+
<ul>
    <li>At the top of every file, include your name, the filename, and the purpose of the file.</li>
+
<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>
+
<li>Comment on what a function is supposed to do before the function definition.</li>
  </ul>
+
</ul>
  
  <li>Change to newline once you reach <b>column 80</b>. Nothing to be typed beyond column 80!</li>
+
<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 it is used for (but please don't make it too long);</li>
 +
<li>and separate words with caps.
  
  <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 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
 
<br/> Eg. no<b>O</b>f<b>O</b>rders, not no<b>o</b>f<b>o</b>rders
    </ul>
+
</ul>
  </li>
+
</li>
 +
 
 +
<li>When naming a function, name it according to what it is supposed to do.
  
  <li>When 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>
 
<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</li>
+
<li>Class names must begin with a capital letter</li>
  
  <li>Declare each variable in a line by itself. It is easier to comment a variable this way. Do not use commas to separate the variable names if they have the same data type.</li>
+
<li>Declare each variable in a line by itself. It is easier to comment a variable this way. Do not use commas to separate the variable names if they have the same data type.</li>
  
 
<code>
 
<code>
    Eg. correct  int i; //To count the number of times in for-loop
+
Eg. correct  int i; //To count the number of times in for-loop
                  int j;  
+
int j;
                  int k; //To count another variable
+
 
   
+
int k; //To count another variable
    Eg. wrong    int i,j,k;          //How do I separately comment  
+
 
                  int i; int j; int k; //the variables here?
+
Eg. wrong    int i,j,k;          //How do I separately comment
 +
 
 +
int i; int j; int k; //the variables here?
 
</code>
 
</code>
  
  <li>Type four (4) spaces over for every block of code. (This is as opposed to tabbing.) For example: </li>
+
<li>Type four (4) spaces over for every block of code. (This is as opposed to tabbing.) For example: </li>
 
<code>
 
<code>
  main () { <br/><br/>
+
main () { <br/><br/>
      int x; //Notice the four spaces over <br/>
+
int x; //Notice the four spaces over <br/>
      int y; <br/><br/>
+
int y; <br/><br/>
      for (x = 0, y = 10; x < 10 && y > 0; 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 x and y is %d\n", x + y); <br/>
+
printf("x is %d, y is %d\n", x, y); <br/>
          if (x == 5)  <br/>
+
printf("The sum of x and y is %d\n", x + y); <br/>
              printf("We've reached the halfway point!\n"); //Moved four spaces over
+
if (x == 5)  <br/>
      } <br/><br/>
+
printf("We've reached the halfway point!\n"); //Moved four spaces over
      printf("Hello, world!"); <br/>
+
} <br/><br/>
  } <br/>
+
printf("Hello, world!"); <br/>
 +
} <br/>
 
</code>
 
</code>
  
  <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>Include an empty line after the declaration of variables (see above example).</li>
 +
 
 +
<li>When using operators, make sure to have a space between the operands and the operator for readability.
  
  <li>Include an empty line after the declaration of variables (see above example).</li>
+
<br/>Eg. <code>i = 0;</code>, not <code>i=0;</code></li>
  
  <li>When using operators, make sure to have a space between the operands and the operator for readability.
+
<li>For keywords such as <code>while, for, if, else, </code> put a space after the keyword and the expression following it.
    <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. <code>if (x == 0)</code> is correct; <code>if(x == 0)</code> is incorrect</li>
    <br/> Eg. <code>if (x == 0)</code> is correct; <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/>
+
<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. <b>CORRECT: </b> <br/>
    <code>int setSafeEmptyState { <br/>
+
<code>int setSafeEmptyState { <br/>
    ... <br/>
+
... <br/>
    } </code> <br/>
+
} </code> <br/>
    <b>INCORRECT: </b> <br/>
+
<b>INCORRECT: </b> <br/>
    <code>int setSafeEmptyState <br/>
+
<code>int setSafeEmptyState <br/>
    { <br/>
+
{ <br/>
    ... <br/>
+
... <br/>
    } </code> <br/>
+
} </code> <br/>
  </li>
+
</li>
  
 
</ul>
 
</ul>

Revision as of 12:30, 28 January 2010


OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources


SVN Repository

oop344_101rep4

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, not void Deliveries, int InitialValues
  • Class names must begin with a capital letter
  • Declare each variable in a line by itself. It is easier to comment a variable this way. Do not use commas to separate the variable names if they have the same data type.
  • Eg. correct int i; //To count the number of times in for-loop int j;

    int k; //To count another variable

    Eg. wrong int i,j,k; //How do I separately comment

    int i; int j; int k; //the variables here?

  • 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!");
    }

  • Only main () will start at column 1. Tab every block of code four spaces over.
  • Include an empty line after the declaration of variables (see above example).
  • 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; if(x == 0) is incorrect
  • When using brackets, put the opening bracket on the same line as the function or expression that opens it.
    Eg. CORRECT:
    int setSafeEmptyState {
    ...
    }

    INCORRECT:
    int setSafeEmptyState
    {
    ...
    }


Issues

Each member will post updates about their progress on the project. Triumphs, conflicts, and blood and tears will go here.


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 ~ ~ ~ ~ ~ ~