User Tools

Site Tools


info:java_style

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
info:java_style [2015/02/18 17:19] – created moritzinfo:java_style [2015/03/10 09:20] (current) – [Objects] moritz
Line 1: Line 1:
 ====== Java code style ====== ====== 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'': <code>public final static int MY_CONST = 3;</code>
 +  * 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''
  
info/java_style.1424276384.txt.gz · Last modified: 2015/02/18 17:19 by moritz

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki