Asgkit Coding STD
Asgkit Coding STD
Coding Standard
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
PSP Fundamentals
Overview
Prerequisites Prerequisites
• Read Chapter 4
Coding Produce, document, and submit a completed coding standard that calls for
standard quality coding practices.
requirements
For LOC counting, ensure that a separate physical source line is used for each
logical line of code.
Coding standard Pages 5 and 6 of this workbook contain an example C++ coding standard.
example
Notes about the example
• Since it is an example, tailor it to meet your personal needs.
• If you have an existing organizational standard, consider using it for the PSP
exercises.
Reuse Instructions • Describe how the program is used. Provide the declaration format,
parameter values and types, and parameter limits.
• Provide warnings of illegal values, overflow conditions, or other conditions
that could potentially result in improper operation.
Reuse Example
Identifiers Use descriptive names for all variables, function names, constants, and other
identifiers. Avoid abbreviations or single letter variables.
Identifier Example
(continued)
Coding Standard September 2007 9 2007 by Carnegie Mellon University
Coding Standard Template (continued)
Comments • Document the code so that the reader can understand its operation.
• Comments should explain both the purpose and behavior of the code.
• Comment variable declarations to indicate their purpose.
Good Comment
Bad Comment
Major Sections Precede major program sections by a block comment that describes the
processing that is done in the next section
Example
Blank Spaces • Write programs with sufficient spacing so they do not appear crowded.
• Separate every program construct with at least one space.
Indenting • Indent every level of brace from the previous one.
• Open and closing braces should be on lines by themselves and aligned with
each other.
Indenting
Example