Java Reference
In-Depth Information
not like
(Foo)foo
Any arithmetic operator should be surrounded by proper white space;
for example:
for (int i = 0; i < x.size(); i++)
return x / y;
versus this:
for (int i=0; i<x.size(); i++)
return x/y;
try/catch/finally
blocks should look like this:
try {
...
} catch (Exception exceptionType1) {
...
} catch (Exception exceptionType2) {
...
} finally {
...
}
Separate declarations, variable names, and default values by a single
space.
All fields in an object must be declared prior to the methods for the
objects. Class fields should be declared prior to instance fields.
When setting a local field, use the same parameter name; for example:
public void
setName(String name)
{
this.name = name;
}
Contextual's code is extremely well designed, religiously refactored, and
highly readable. It behaves well with the tools, and is easily learned by new
hires. As you can see, a coding standards document doesn't have to be long to
be effective. It should address issues that are important to the programming
teams and their clients, both internal and external.