Requirements for all programs
All programs that I am marking carefully need to have the following things. Note: this means all programs except those in green boxes
Checklist (we haven't learned all of these yet)
-
-------- comments and formatting -------
- comments at the top with:
- your full name
- date
- brief line saying what the program does
- ★ major methods have comments describing what they do (including parameters)
- correct indentation
- vertical spacing
(blank lines are used to ideas or separate sections of code)
-------- variables -------
- class name (and filename) starts with Capital letter
- all variable names are lower case (any rare exception to this must be justified)
- variables are of the correct type
- variables have names that make sense
- important variables have comments explaining them
- global variables are as few as possible
- (it is especially important that global variables are well named and have a comment saying what each is used for
- constants, when used, are in ALL CAPS ------- program functionality & style --------
- no && or || in for loops. e.g. NOT:
for (int i=0; i >=0 && i < 20; i++)
- no comma operators in for loops unless absolutely required
- no else if () unless absolutely required
- input is checked to make sure that it is the correct type (and range if applicable)
- the program can't be crashed by typing in the wrong thing
- long sections of code are split up into methods (functions or subroutines)
- large repeated sections of code are refactored to use for-loops, arrays, and/or arraylists
- methods (as well as classes) have names that make sense and are helpful/descriptive
- code is easy to follow.
- code is efficient and works well (nothing convoluted or unnecessary)
- variables and methods (and imports) that are no longer used have been removed
- comments that are no longer applicable have been removed (don't have "TODO" or "FIXME" in a final version of a program!)
- error messages are clear and understandable
- no magic numbers! Use constants instead.