Pac Man Coding Standards

 

Group 8 Coding Standards Document Pac Man
History of Revisions: 11/04/02 Paul Force Initial Document Creation


Indenting
Three spaces
Indent twice when a line must be wrapped
Line Length
There should be a maximum of 80 characters per line
Braces
Appear on a line by themselves
All text between (but not including) opening and closing braces are indented at least one level from that of the corresponding braces
Use braces for 'if', 'for', etc. statements even if there exists none or only one statement
Code Structure
Operator precedence in compound operations should be explicitly denoted by surrounding parentheses
Naming Conventions
Names should be descriptive (excluding loop counters)
Class Names
Each word within the name is to be capitalized
Example: MySuperClass (note: this is NOT descriptive)
Method Names
The first word begins with a lower-case letter, each additional word within the name is capitalized
Variable Names
Use the same naming convention as method names
Constant Names
Each letter of the name is capitalized, with words separated by underscores

Whitespace
A space should be placed after ',' and ';', unless at the end of a line
A space should be placed after the opening parenthesis and before the closing parenthesis when used for keywords
A space should be placed after keywords when followed by an opening parenthesis
e.g., for ( ... )
Binary operators should be surrounded by spaces
Comments
The '//' comment delimeter should be used for comments
The '//' comment delimeter should begin at the same indentation as the commented portion
The second and subsequent lines of comment should be indented twice from the associated '//'
Abbreviations should not be used in comments
Comments should not depend on code specifics, but instead reflect the process or procedures used
The top of each file should contain a short header comment containing
the name of the file
a brief statement of the file contents
the author's name
the date the file was created
If more than one class is contained in a file, each class should have a short header containing
the class name
what, if any, classes it is derived from
a brief description of the class
Each function declaration and definition should be preceded by a short comment containing
what the function does
the role of each input value
any assumptions the function makes about the input values
any guarantees the function makes about its output value
When revising code, the comments should be updated, including adding the following to headers
the date of modification
the name of the person who performed the modifications
a brief statement of the revisions
Types
Types should be all lowercase, with underscores separating words