|
Some common errors, marked with greek letters (lower-case). (See also, common proofreading marks.)
If you call a function, either put the entire function call ona single line, or put each arguments on its own line.
; good (f a b c) (f a b c) ; bad (f a b c) ; Horrible: (f a b c) |
; okay: (overlay/align 'right 'center (rotate -90 (triangle 20 "solid" "orange")) (ellipse 40 20 "solid" "blue"))) |
/** 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 ) |
/** Returns whether or not a grocery-item ID is for an item which is sold by weight. * @param An ID `number', like "1572935" or "47AGM231". Must be a valid ID. * @return true if and only if the ID'd item is sold by weight. */ static boolean isSoldByWeight( String id ) |
Incomplete testing. You should have test cases each method you write. Test cases include actual inputs, and the expected result.
Some functions need more test cases than others.
if (someCondition) { return true; } else { return false; } |
return someCondition; |
SomeType someVar = someExpression; return someVar; |
return someExpression; |
©2011, Ian Barland, Radford University Last modified 2011.Nov.28 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |