CS1112 --> Projects
--> Programming Style
Below are some basic and important guidelines. Note that early in the semester we are not
too concerned with efficiency.
- Documentation (comments)
- Begin each script with a concise comment describing the program.
- In a function, the function comment follows the function header and
gives the specifications concisely, including the descriptions of the parameters.
- Code should be sufficiently, but not excessively, commented. For example,
define constants and important variables with comments and write a concise comment for
each individual block of code.
- General style
- Conciseness and efficiency
- There should be no superfluous code (e.g., an empty if or else branch
or a useless loop)
- Code should be reasonably efficient. (Note that optimal efficiency is not required; reasonably
efficient code is expected.)