Java Code Conventions

All code associated with the Echo framework hosted on this site follows a slightly modified version of Sun's Code Conventions for the Java Programming Language. The following specific modifications are used:

  • Indentation is done exclusively with spaces. Tabs are not allowed. Indentation unit is four (4) spaces.
  • Lines should be wrapped at a 132 column margin.
  • Braces are always used to enclose the bodies of if/for/while/try statements.

Sample code:

public class Alpha extends Bravo
implements Charlie, Delta {

    private String[] juliet;
    private int kilo;

    public void tango(int uniform) {
        System.err.println(uniform + kilo);
    }

    public String zulu(String yankee, int xray, boolean whiskey,
            String victor)
    throws OtherVendorFouledUpException, FooException {
        switch (xray) {
        case 4:
        case 5:
            return "Yep!";
        default:
            return "Nope!";
        }
    }
}