====== Java code style ====== Java does not enforce a particular code quality language-wise and therefor programmers should follow certain guidelines when writing code. As all guidelines, they might be violated for a good reason. * [[http://www.oracle.com/technetwork/java/codeconventions-150003.pdf|Java code conventions]] * [[https://google-styleguide.googlecode.com/svn/trunk/javaguide.html|Google Java code style]] ===== Classes ===== * All public class fields must be ''final static'': public final static int MY_CONST = 3; * Class members have to be named uppercase with underscore between words: ''MAX_INTEGER'' ===== Objects ===== * All fields must be ''private'' and only accessible through getters and setters. * All fields must be ''final'' unless functionality requires mutability. ===== Constructors ==== * Constructors must not call any method unless it is ''private'' and in turn does not call any non-private method. * Fields assigned in the constructor must be ''private final''