CMSC Coding Standards Summary
The following summary of CMSC 202 coding standards is provided as a
checklist for your project submittals. Please read the fully
detailed coding standards.
Coding standards make up 15% of each programming project.
Although every attempt is made to
summarize each coding standard, some may have been inadvertently left
off this list. It is your repsonsibility to read and understand the
complete
coding standards document.
Minor deviations from the standard carry
a 1 or 5 point deduction depending on how many infractions are found.
Major deviations from the standard carry a 5 or 10 point
deduction depending on how many infractions are found.
Serious deviations from the standard carry a 10 or 15 point
deduction depending on how many infractions are found.
For example, if only one function name does not follow
the function naming convention, expect a 1-point deduction.
If several function names fail to follow the function
naming convention, expect a 5-point deduction.
You should expect to have points deducted from your project score
for each of the following.
Minor Infractions (1 or 5 points)
- use of file extensions other than .C and .H
- primary file ( the one with main() ) not named projN.C (e.g. Proj1.C)
- executable not named ProjN (e.g. Proj3)
- .H files not guarded
- unnecessary inclusion of header files
- failure to follow naming conventions for
- class names
- class data members
- class methods
- variables
- functions
- use of poorly named variables, constants or functions
- function prototypes with unnamed parameters
- functions with empty parameter list that is not explicity "void"
- constant names, values and comments not columnar in declaration
- multiple variable declarations per line
Major Infractions (5 or 10 points)
- multiple classes defined in one .H file
- multiple classes implemented in one .C file
- multiple private and/or public sections in class definition
- insufficient or improper use of const for parameters
and methods
- insufficient or improper use of reference parameters
- default values for parameters not specified in the prototype
- use of magic numbers and magic strings
- improper use of single-letter variable names
- code that is unreadable
This would include such items as
- insufficient use of blank lines
- insufficient use of spaces
- improper code indentation (too little or too much)
- in-line comments improperly indented or improperly placed
- Appropriate comment style
This would include items such as
- insufficient in-line comments in the code
- comments that contradict the code
- comments that belabor the obvious
- invalid style for braces
- incomplete or missing file header comments
- incomplete or missing function header comments
Serious Infractions (10 or 15 points)
- class method(s) implemented in .H file
- class data members that are not private
- use of global variables
- untested pre-conditions