Professional Documents
Culture Documents
Purpose
Counting Standard
Program Headers
Header Format
/***********************************************************/
/*Name:yourname*/
/*Date:thedateyoustarteddevelopingtheprogram*/
/*Description:ashortdescriptionoftheprogramandwhatitdoes*/
/***********************************************************
*******/
Contents
Contents
/
**********************************************************//
*Contents:*/
Example
/*Reuseinstructions*/
/*Modificationinstructions*/
/*Compilationinstructions*/
/*Classdeclarations:*/
/**********************************************************/
Reuse Instructions
Reuse Example
Describe how the program is used. Provide the declaration format, parameter
values and types, and parameter limits.
/*********************************************************/
/*Reuseinstructions*/
/*Param:Parameterofprogramwithtype.*/
/*Purpose:toprintstring,line_of_character,ononeprintline*/
/*Return0ifprinternotreadytoprint,else1*/
/
************************************************************
******/
Identifiers
Use descriptive names for all variables, function names, constants, and other
identifiers. Avoid abbreviations or single letter variables.
September 2011 1
Identifier Example
intnumber_of_students;/*ThisisGOOD*/
float:x4,j,ftave;/*ThisisBAD*/
Comments
Document the code so that the reader can understand its operation.
Comments should explain both the purpose and behavior of the code.
Major Sections
Example Major
sections
/*Theprogramsectionexaminesthecontentsofthearraygradesand
calculatestheaverageclassgrade.*/
//Thissectioncalculatesthesumofa+b
Blank Spaces
Indenting
Open and closing braces should be on lines by themselves and aligned with
each other.
Indenting
Example
while(miss_distance>threshold)
{success_code=move_robot(target_location);
if(success_code==MOVE_FAILED)
{Console.WriteLine,(Therobotmovehasfailed.\n);}
}
Capitalization
Capitalizealldefines.
Lowercaseallotheridentifiersandreservedwords.
Tomakethemreadable,usermessagesmayusemixedcase.
Capitalization
Examples
usingBL;
intnumber_students=6;
September 2011 2