In general, your program grades will be based on:
Similarly, if you are told to use specific names for your files, or
to have your program produce specific output, use the names and the
output exactly as specified -- using similar names/output is not
acceptable.
Efficiency
Efficiency is not the major concern of this class, but it is an
important aspect of good programming, so needlessly inefficient
code may be penalized.
For example, you may lose some points for an O(N2)
algorithm if there is an obvious equivalent algorithm that is O(N).
Style
Style considerations include reasonable comments (e.g., comments
that explain each class, that set off each method, and that explain
non-trivial parts of the code),
indentation that reflects program structure,
and meaningful names (e.g., for methods, fields, and variables).
Test Coverage
Testing is one of the most important (and most difficult) aspects of
programming.
One goal is to design tests so that every statement in the code is
executed at least once.
You should also think about "boundary" cases (e.g., applying operations
to empty data structures or to structures that contain a single value) and
error conditions (for example, if your code throws exceptions or produces
error or warning messages under
certain conditions, you should be sure to test those conditions -- use
a "try" block to catch exceptions so that your test program doesn't
halt).
It is important to design tests to produce output that makes it clear whether there are errors in the code. A good approach is to have the test code produce output only if the code being tested behaves in an unexpected way (and in that case, the test code should report the unexpected behavior).