= Coding Standards = Anyone working on OpenSHA should strive to write efficient, well-documented, and testable code. To encourage readability and uniform presentation, several syntactic standards to which this project adheres are outlined below. Most of the recommended syntax configurations can be set within your IDE of choice. == Syntax == '''Tabs''' : Use tabs, not spaces. This allows individuals to adjust indentation to their liking. '''Line Length''' : Limit lines to 80 characters. Wrap long lines appropriately. '''Line Wrapping''' : Indent wrapped lines with two tabs. '''Code Blocks''' : methods, for-loops, if-statements, etc... * The opening bracket "{" of any new block should be on the same line as the start of the block * The closing bracket should be on its own line aligned to the opening indentation of the block. * The only exception is the case of where the entire block can fit on one line, e.g.: {{{ if (false) return; }}} '''Arguments/Parameters''' : * If a method takes more arguments than can fit on the opening line, wrap the line starting at the first argument. * If there are many arguments, consider putting each one on it's own line. '''Scoping''' : * All class members and methods should be scoped as applicable for their use. * Unless absolutely necessary, member fields should be private. '''Java1.5 Enhancements''' : Use features introduced in Java 5 for more readable, less error-prone code. * [http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html Generics] * [http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html Enums] * [http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html Enhanced For-Loop]