Guidelines for Code Quality
In addition to the correctness of your program, you will be graded based on the quality of your code. Your grade will be composed of the following elements:
- Documentation: Code is well documented and written in a way that makes it easy to comprehend
- Docstring comments are provided for every function (unless the assignment explicitly states otherwise)
- Comments throughout code make code easier to understand for the reader
- Function, variable, and class names are descriptive
- Style: You follow best practices for style in your code
- Whitespace is used appropriately to:
- Logically separate pieces of your algorithm
- Make expressions more readable
- Consistent style is used for variable, class, and function names
snake_case
andcamelCase
are both acceptable for variables and functions, but choose one and stick with it!
- Line length does not exceed 100 characters
- “Commented out” code that is not functional is removed
- Whitespace is used appropriately to:
- Design: Your code is written efficiently and appropriately uses programming constructs
- Variables are used effectively and help to avoid repetition
- All branches of conditionals are reachable
- Brevity: you should not copy-paste code within your program if at all possible!
- Code is separated into meaningful functions
- Loops are used when you are doing the same thing multiple times
break
andcontinue
are used sparingly
- Code shows good understanding of programming constructs
- Appropriate use of data structures
Each component will be graded on a scale from 0-3:
- 3: Excellent. Zero or one minor error.
- 2: Good. A few minor errors or one major error.
- 1: Fair. A large number of minor errors or a few major errors.
- 0: Poor. No attempt was made (for instance, no comments in code).
While documentation and style are important, design is the skill that I want to reinforce the most in CSCI 145. Therefore, your code quality will be computed as follows:
quality = documentation + style + 2 * design