ITEC120-ibarland (incl. office hrs)—info—lectures—labs—hws
hw04 grading guide
Some common errors, marked with greek letters (lower-case).
(See also, common proofreading marks.)
- α (alpha):
Poor indentation.
The principle is simple:
if one line is a sub-part of another, then indent it.
For instance:
-
The body of a loop is indented relative to the first line of the loop.
-
The lines inside a method are a sub-part of that method.
-
Methods in a class are indented with
(Consider how reading this very paragraph is easier, because of how
the web browser indents items of a lists.)
Also,
- include blank lines between different methods
(since they are separate parts, like separate paragraphs).
-
Don't put blank lines between comments and the code being commented about.
-
Include spaces between words and punctuation, as needed.
For examples of good, readable code,
look at any code in the class notes or in the book.
- β (beta):
Lack of javadoc.
Include one @param for each parameter (explaining what it means),
and one @return if the method is non-void.
You should be able to look at the interface-view, and put yourself in
the mindset of a fellow programmer who wants to call your functions.
Do you provide enough information?
Note that your javadoc does not discuss
how your program works (its implementation),
but rather what your program does (its interface).
- γ (gamma):
Repeated code:
Write soldByWeight once, and then call it as needed.
Note that if things change in the future,
about what determines whether an item is sold by weight,
then your code should one require changes to that one method.
- δ (delta):
Missing function: you were asked to write both a static and
a non-static method, for soldByWeight.
Please read the problem carefully.
- ε (epsilon):
discount should modify the price of an item.
That is, if you walk up to a bottle of soda and ask its price,
suppose is says "0.80". Then you say “hey bottle of soda,
discount yourself by 50%”. Now, if you ask the bottle its
price, is should say "0.40".
I took off less than usual for this, because the assignment was
arguably unclear; the root of the problem is that I intended
“discount” as a verb (“discount that item!”),
but it can be interpreted as a noun
(“tell me the discount”).
- ζ (zeta):
Incomplete test method.
You should have one or more tests for every method.
In particular, many people wrote discount,
but never called it from their test method
(which might have led people to think about the previous
item, of what should
happen to the price, after a discount).
- η (eta):
Two constructors were asked for.
Please read the handout, else you'll lose easy points.
- θ (theta):
The constructors need to check that their sold-by-weight status
agrees with the id number given to them.
Please read the handout, else you'll lose easy points.
- λ (lambda):
Unclear/unhelpful comments.
An example of unhelpful commenting:
/** The lines of code below are taking in an ID and returning a boolean.
* @param id an ID.
* @return true or false
*/
static boolean isSoldByWeight( String id )
|
A more helpful description:
/** Returns whether or not the ID is for an item which is sold by weight.
* @param An ID `number', like "1572935" or "47AGM231".
* @return whether or not the ID is for an item which is sold by weight.
*/
static boolean isSoldByWeight( String id )
|
True, it is annoying to repeat the same info twice, but often (not always)
the @return line is also a succinct overall description.
(This is a lack of a single point of control, forcing me
to have the same information cut/pasted in two places.
Really, the program which generates a web page from your
program should use the @return line as the overall description,
if an overall description isn't otherwise provided.)
ITEC120-ibarland (incl. office hrs)—info—lectures—labs—hws