Java Reference
In-Depth Information
Spacing:
1 Use two lines between the package statement and the first import.
2 Use two lines between the last import and the public class section.
3 Use two lines between each method.
4 Do not insert blank lines after the class open curly brace or directly
before the class closed curly brace.
Method blocks should follow this format:
public String
doIt(String x,
String y,
Object somethingElse)
throws Exception,
OtherException
{
...
}
Code should maximize the usage of short-circuiting. Error conditions
should be at indentation level 8, the main path of execution should be
at 4 (unless it is imbedded within a try/catch , for , etc.).
Indentation level is 4.
You should use // to indicate comments unless they are for JavaDoc pur-
poses. Comments should begin no less than one full space after the sec-
ond slash.
Do not use underscores in class names, variable names, method names,
and so forth. Use camel case syntax instead.
Do not recompute the size of a vector each time you do the loop check;
for example, don't do the following:
for (int i = 0; i < someVector.size(); i++)
Use the syntax !!! in a comment to signify that the code needs to be
revisited at that spot.
Code should be less than 80 characters per line where possible.
Declare variables where they are first used, not at beginning of a
function.
A cast looks like:
(Foo) foo
Search WWH ::




Custom Search