Draft for coding discipline:
Written by Lim Meng How
Date :25 may 2000
1.0 software notation:
Variables should be defined as according the following notation. The aim of this practice is to
produce code which is easier to be read and maintanced by group of programmers.
local variable:
bi_ bit
b_ byte
w_ word
dw_ dword
su_ structure
pf_ pointer to function
ps_ pointer to structure
global varable:
gbi_ bit
gb_ byte
gw_ word
gdw_ dword
gsu_ structure
gpf_ pointer to function
gps_ pointer to structure
2.0 Comment
Comment should used for all braces that encapsulate function, for loop , while loop
and switch case. Comment should also be inserted for every if and case condition.
All variables and structures should be commented.
3.0 Indentation
All nested ifs ,for loop, while loops as well as swtiches should be indented for
Ease of maintance and readability
4.0 Alignment
The open and close braces should be aligned in the same column.
Below is a sample for identation , comment and aligment for reference.
function () /* start of function */
{
if ( condition1 )
{ /* start of if ( ) ,short description….. */
if ( ) /* description of if condition ….*/
{
switch ( ) /* start of switch ,short description….. */
{
case 1: /*description of case …*/
instruction ......
break;
case 2: /*description of case */
instruction ........
break;
default: /* description od default case */
break;
} /* end of swtich , short description…..*/
} /* end of if ( ) ,short description….. */
else
{ /* start of else ,short description …..*/
} /* end of else ,short description …..*/
}
else
{ /* start of else ,short description …..*/
} /* end of else ,short description …..*/
} /* start of function */
Copyright message should be included at the start of each header,source and script file.
Sample of copy right message as follows:
To be discussed……….
6.0
All version source code, header and script file should have the following comment.
/*Vesion : */
/* Date of released */
/* Description : date programmer item 1… */
/* date programmer item 2 … */
/* */
/* */
/* */
Sample are provided as follows:
/*
/* Date of released : 18 Jun 2000 */
/* Description : 6 Jun 2000 menghow fixed bugs on… */
/* 8 Jun 2000 adam Iimplement ….feature . */
/* */
/* */
/* */
For example revision 0.6 should timestamp to 00:06:00 am