Java Coding Convention

Improvements? Suggestions? email


Use JS coding conventions, except for the following, use C coding conventions:

  • class definitions: like C struct
  • variables: like C variables
  • field in a class should have m_ prefix
  • static public should NOT have g_ prefix
  • anon class will be declared like anon function in js
  • if overriding method use @Override in line above:
    @Override public void on_change(...)
    public void on_change(...)
  • no getter or setter need for internal classes
  • private fields in class must be at start of the class (there is an exception when it is the main class of the file)
  • synchronized should be formatted like JS function/catch:
    synchronized (a) { a = 1; }
    synchronized(a){ a = 1; }
        a = 1; }
        a = 1;
        b = 1;
  • classes with a single method can use the JS tiny function style:
    new Thread()
    new Thread(){
    new Thread(){ run(){
    new Thread(){ run(){
       ...; }};
    new Thread(){ run(){ ...; }};
  • main class (that the file is named after) content should not be indented

Well hello there!

We're in the process of giving our website a
new look, call it a makeover if you prefer :)

Rest assured, this will be updated soon too,
we're on it.