How I Grade Computer Programs

0. Correctness: A program which doesn’t give correct answers can meet any other design goal:

  • It can be as fast as you want.
  • Use as little memory as you want.
  • And it will always be finished on time.

Running correctly comes before any other goal or requirement, so I make it goal 0. I take off the most points for programs that don’t give the right answers. You will be shocked and appalled by how many points you lose for programs which give wrong answers. Wrong answers affect your grade in proportion to how easy they are to detect. If rudimentary testing would reveal the problem, you will lose more points than you would from a subtle, hard to find error.
Test your programs.

1. User interface: misleading or missing labels, error messages which are hard to understand. Your goal should be to write programs which people know how to use with little or no training. User interfaces should be clean. Use color and graphics only to enhance understanding and ease of use.

2. Code which illustrates a lack of understanding of the language.  E.g:

Doing the same thing twice.
Converting a string variable to a number variable then using the string variable for mathematical operations.
Doing things which are unnecessary.
Doing the same wrong thing which 5 other people sitting near you did.

3. Failing to follow programming conventions. e.g. meaningful variable names