Difference between revisions of "OOP344 - HOTYS - 20102"

From CDOT Wiki
Jump to: navigation, search
(Coding Style Rules)
(Coding Style Rules)
Line 47: Line 47:
 
<pre>
 
<pre>
 
Every file should have a function header with:
 
Every file should have a function header with:
 
 
File name
 
File name
 
 
Programmer Full name
 
Programmer Full name
 
 
Date last modified
 
Date last modified
 
 
  
 
Variable names should be meaningful so additional comments are not necessary to explain what the variable does
 
Variable names should be meaningful so additional comments are not necessary to explain what the variable does
 
 
  
 
A lower case prefix should be fitted to the variable name to help describe it at a glance:
 
A lower case prefix should be fitted to the variable name to help describe it at a glance:
 
 
n int
 
n int
 
 
c character
 
c character
 
 
b Boolean
 
b Boolean
 
 
f fload
 
f fload
 
 
d double
 
d double
 
 
s C-style null terminated string OR a string object
 
s C-style null terminated string OR a string object
 
 
  
 
Ex:
 
Ex:
 
 
nNumOfSignals
 
nNumOfSignals
 
 
cCharPassed
 
cCharPassed
 
 
bIsTrue
 
bIsTrue
 
 
fLength
 
fLength
 
 
dWidth
 
dWidth
 +
sUserInput
  
sUserInput
+
Also for Classes, ALL Data Member should have a m_ prefixed to the name to show that it is a Data Member ( Instance Variables )
 +
Ex:
 +
int m_nType;
 +
NOT
 +
int nm_Type OR INT mn_Type;
  
+
All variable declaration should be done on it's own lineS
  
 
There should be NO single character names for variables (Ex: i, j, k, etc) except for arbitrary counters, such as for loops
 
There should be NO single character names for variables (Ex: i, j, k, etc) except for arbitrary counters, such as for loops
  
 
  
 
 
 
  
 
Function names should have meaningful names (they do not require prefix)
 
Function names should have meaningful names (they do not require prefix)
 
 
Each function should have only one point of entry and one point of exit.
 
Each function should have only one point of entry and one point of exit.
 
 
I.E. There should be only 1 return statement in each function.
 
I.E. There should be only 1 return statement in each function.
 
 
  
 
Each function should have a header describing what it does.
 
Each function should have a header describing what it does.
 
 
  
 
Use Inline comments to describe hard to read code.  All inline code should be set to the same indention as the code it is describing.  
 
Use Inline comments to describe hard to read code.  All inline code should be set to the same indention as the code it is describing.  
  
 
 
 
  
 
Opening braces should be on the same line as the defining function/if/else if/etc statement.
 
Opening braces should be on the same line as the defining function/if/else if/etc statement.
 
 
Ex:
 
Ex:
 
 
void FunctionOne(int){
 
void FunctionOne(int){
 
 
if (x > y){
 
if (x > y){
 
 
NOT
 
NOT
 
 
void FunctionOne(int)
 
void FunctionOne(int)
 
 
{
 
{
 
 
if (x > y)
 
if (x > y)
 
 
{
 
{
  
 
 
 
  
 
There should be NO use of the tab character!!!
 
There should be NO use of the tab character!!!
 +
Each indent should be 3 blank spaces!  I will write a wiki on how to set this up in VS 2008, VS 2010,And Notepad++
  
Each indent should be 3 blank spaces!  I will write a wiki on how to set this up in VS 2008, VS 2010,And Notepad++
 
  
 
</pre>
 
</pre>
  
 
<br /> <br />
 
<br /> <br />

Revision as of 15:10, 23 May 2010


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

This is team HOTYS homepage!!!

The Name of the team is derived from the first letter of each group member's name:

Han Chul Kim
Osman Mirza
Tony Kim
YuJin Jeong
Stephanie Law


Member List

OOP344 - 2010 Team HOTYS -
Last
Name
Name Seneca
Username
Section Blog Url IRC Nick My Contributions
a Kim Han hckim3 A http://hckim.wordpress.com/ han3 Hckim3
b Mirza Ozzy omirza A http://0zzym.wordpress.com/ OzZy_M OzZy
c Kim Tony kjkim A My Blog TonyKim kjkim
d Jeong YuJin yjeong A Spirit & Soul YuJin Takeiteasy
e Law Stephanie slaw12 - A My Blog- Slaw12 slaw12

Team Project

Team Project


Discussions

Discussion Page


IRC Schedule/Log

IRC Page

Coding Style Rules

Every file should have a function header with:
File name
Programmer Full name
Date last modified

Variable names should be meaningful so additional comments are not necessary to explain what the variable does

A lower case prefix should be fitted to the variable name to help describe it at a glance:
n int
c character
b Boolean
f fload
d double
s C-style null terminated string OR a string object

Ex:
nNumOfSignals
cCharPassed
bIsTrue
fLength
dWidth
sUserInput

Also for Classes, ALL Data Member should have a m_ prefixed to the name to show that it is a Data Member ( Instance Variables )
Ex:
int m_nType;
NOT
int nm_Type OR INT mn_Type;

All variable declaration should be done on it's own lineS

There should be NO single character names for variables (Ex: i, j, k, etc) except for arbitrary counters, such as for loops



Function names should have meaningful names (they do not require prefix)
Each function should have only one point of entry and one point of exit.
I.E. There should be only 1 return statement in each function.

Each function should have a header describing what it does.

Use Inline comments to describe hard to read code.  All inline code should be set to the same indention as the code it is describing. 


Opening braces should be on the same line as the defining function/if/else if/etc statement.
Ex:
void FunctionOne(int){
if (x > y){
NOT
void FunctionOne(int)
{
if (x > y)
{


There should be NO use of the tab character!!!
Each indent should be 3 blank spaces!  I will write a wiki on how to set this up in VS 2008, VS 2010,And Notepad++