Engineering Science 1036A/B Lecture 9: C++ Basics: Programming Style & Documentation
Comments
Include summary at beginning of the program to explain what the program
does, its key features, its supporting data structures, and any unique techniques
it uses
•
Include name, class section, instructor, date, and brief description at beginning
of the program
•
Naming Practices
Choose meaningful and descriptive names
•
Variables and function
Use lowercase
If the name consists of several words, use lowercase for the first word,
and capitalize the first letter of each subsequent word in the name
○
•
Class names
Capitalize the first letter of each word in the name
•
Constants
Capitalize all letters in constants, and use underscores to connect words
•
Proper Indentation and Spacing
Indentation
Indent two spaces
•
Spacing
Use blank line to separate segments of the code
•
Block Styles
Programming Style & Documentation