User Tools

Site Tools


info:java_style

This is an old revision of the document!


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.

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'
info/java_style.1425975591.txt.gz · Last modified: 2015/03/10 09:19 by moritz

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki