Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Java Style Guide
If you want to contribute code to the Watchmaker project, please adhere to the following coding standards.
The short version of this document is that any new code should be formatted the same way as the existing code. Other than brace placement, this is broadly similar to the standard Sun Java coding conventions.
Currently the project builds and runs with Java 5.0. We intend to keep it that way for the foreseeable future, so please don’t introduce dependencies on later versions of Java.
- All opening and closing braces must be on a new line by themselves (i.e. not K&R style).
- All blocks must have braces (i.e. no single-line ifs).
- No wildcard (
- Imports should be listed strictly in alphabetical order with no blank lines separating them (i.e. no grouping of core, project and third-party packages).
- No C-style (
/* ... */) mutli-line comments, use multiple C++ style (
//) single-line comments instead.
Indentation and Layout
- Indent only with spaces (no tabs). Use four spaces for each level of indentation.
- Prefer vertical scrolling to horizontal scrolling. If necessary to avoid long lines, method parameters, throws lists, etc. should be listed one per line (horizontally aligned so that they all start in the same column). Lines longer than 120 characters should be avoided if at all possible.