Java code review
Code style guidelines
In general, follow the Google Java Style Guide as set out on GitHub at this URL:
https://google.github.io/styleguide/javaguide.html
The exception is that you are not expected to document the code. Helpful one-line comments are
fine.
Also, you are not expected to use annotations.
The following are rules that MUST be enforced.
All class, variable, and method names should be meaningful. E.g. for a method that lists
books, the name should be listBooks(), rather than lbk().
Class, variable, and method names should not use abbreviations, except for common
acronyms (e.g. html rather than HyperText Markup Language)
Class names should start with a capital and use CamelBack.
Variable names should be nouns or noun phrases, start with a lower case letter and use
camelBack.
Method names should be verbs or verb phrases, start with a lower case letter and
useCamelBack.
Indentation increments should be 4 characters.
All variables and operators MUST be separated by white space. E.g.:
Not:
a=b+c+d; Rather:
a = b + c + d;
Anywhere curly brackets MAY be used, they MUST be used. E.g.:
Not:
if (condition) some single line of optional code; further non optional code; Rather:
if (condition) { some single line of optional code; } further non optional code;
Random rules that must also be enforced:
There should be no method calls within argument lists of any method calls.
No calculations within Boolean expressions
No negated Boolean variable names or negated Boolean methods. E.g. ‘isError’ rather than
‘isNoError’.
Singletons should return their sole instance through a method called getInstance()
All class and method declarations should be separated from the previous block of code by 2
space lines.