This page outlines the style rubric we look at when grading your homework assignment so that you can quickly refresh yourself on things to do when writing code. Note that this is NOT a general outline of why style is important or why a specific style error is considered in error. You can read more about that on the Style Guide resource page.
Note: We do not list how many points these deductions are worth. This is because the point weighting varies from assignment to assignment.
These two style errors don’t follow a specific category and usually indicate more significant issues in the submission:
There are two types of Checkstyle errors, one for the number of checkstyle errors, and one for the number of Checkstyle error types.
These two types of deductions are independent.
camelCase
(except for constants, which should be ALL_CAPS_WITH_UNDERSCORES
)TODO
comments left in code when that TODO was completed. These should be replaceed by your own comments as you fill in your code.while
loop where a for
loop would work just as well.if (booleanExpression == true) {}
- since the variable is a boolean
already, you don’t need to compare it to true
.if (x == y) {
return true;
} else {
return false;
}
Instead of evaluating the conditional, we can just use it directly since it already results in a boolean. For the example provded above, we could rewrite it as just:
return x == y;