Computer Science 15-110, Spring 2010
Style Rubric
Style is typically worth about 15 points on each hw. Each style issue is
either entirely right or not. So if you have ONE line beyond 80 characters, then
you lose the 2 style points for that issue. If you have 50 lines beyond 80
characters, you do not lose 50x those points. You just lose them once per issue.
While you may in theory lose up to 5*4 + 2*15 = 50 points, there are
no negative style grades. Lowest style grade is 0.
- 5-Point Style Issues
- Compile without errors (even if your code has logical errors or
runtime errors!).
- Use correctly-named files with correctly-named methods (where applicable)
(Note: simple rule -- it is a 5-point penalty if CA's must manually edit
your code to get the autograder to work)
- Use comments
(Note: not using any comments is a 5-point error; not using
enough comments is just a 2-point error.)
- Use top-down design with unit testing
(Note: not using any helper methods (where appropriate) or any
test methods is a 5-point error; not using enough is just a
2-point error.)
- 2-Point Style Issues
- Include your name, andrew id, and section in a comment at the top of
every file you submit
- Use a clear, robust design
- Use meaningful variable and method names (whenever possible)
- Use proper mixedCase/camelCase naming
- Variable names start lowercase (eg: tetrisPiece)
- Class names start uppercase (eg: TetrisPiece)
- File names match class names (start uppercase)
- Constants ("final" variables) are all uppercase (with underscores) (eg:
TETRIS_ROWS)
- Include all obvious boundary cases in test methods
- Do not have more than 15 lines in any one method (or 20 lines for
graphics methods).
(While it is possible to have a well-written 15+ line method, we
need a simple hard-and-fast rule for grading purposes...)
- Comment liberally but not excessively, using clear language in
comments
(Note: if you do not write any comments, then you lose 5 points
from the previous list and so this item would not apply here.)
- Do not exceed 80-characters in any one line
- Indent properly.
- Do not use magic numbers.
In particular, every number besides -2, -1, 0, 1, or 2 must be
stored in a well-named variable.
- Do not be grossly inefficient
(You are generally not responsible for efficiency in 15-100, and you do
not have to use the most efficient solution in general; but
the exception is if you are truly "grossly" inefficient,
particularly if your approach is also unclear, and especially if you had
simple, clear, and reasonably efficient options to choose from.)
- Do not duplicate code
- When appropriate, provide meaningful UI (clear prompts, clear
output)
- Use "else" where appropriate
So this code loses 2 points:
if (x < 2)
foo();
if (x > 3) bar(); // <- should be "else if"
- Follow other guidelines as described in the class notes
carpe diem -
carpe diem - carpe diem - carpe diem
- carpe diem - carpe diem -
carpe diem - carpe diem - carpe
diem