Code Conventions

See the Java Code Conventions (local mirror) for the standard conventions. The following recommendations extend these standard conventions for the GESMES/TS suite:


Indentation

The indentation of blocks is one tab character. Therefore it is recommended to set up your editor that it shows one tab jump as wide as 4 spaces (a choice you probably don't have with your HTML viewer).

for ( int i = 0; i < vec.length; ++i ) {
	System.out.println( vec[i] );
}

Space before evaluation brackets

In order to distinguish declaration/definition of a constructor or method from its use, use a single whitespace before the opening bracket for the declaration/definition, but when calling, use no space before the bracket:

class Something {
	// Constructors
	Something () { this( 0 ); }
	Something ( final int size ) { ... }
	...
	// Methods
	Iterator iterator () { ... }
	Something getChild ( final int index ) { ... }
	...
}

And now calls to constructors and methods:

final Something someThis = new Something( size );
final Something someThat = new Something();
...
final Iterator iterator = someThis.iterator();
final Something someChild = someThis.getChild( size / 2 );

The use of space characters within the brackets should aid the reader. But no prescription extending the Java Code Convention has yet been agreed upon. So the preceding paragraph could also be formatted like this:

final Something someThis = new Something(size);
final Something someThat = new Something();
...
final Iterator iterator = someThis.iterator();
final Something someChild = someThis.getChild(size / 2);

Note here that the Java Code Convention specifies that binary operators except the dot operator should be spearated from their operands by space. This rule was adhered to in both examples.