Java Coding Conventions - Texera/texera GitHub Wiki

Author: Zuozhi Wang

This document specifies the coding conventions in Texera project.

  1. Use spaces instead of tabs. Configure your IDE or text editor to use 4 spaces instead of tabs.
    In Eclipse
    In IntelliJ, uncheck use tab character.

The reason is that Github shows tab as 8 spaces, thus leading to inconsistency of indentations. Different people may have different configurations, which may mess up the space / tab and show a lot of changes in git diff.

  1. Use camel case, e.g. SampleClass, sampleVariable
    For constants, use all upper case with underscores, e.g. SAMPLE_CONSTANT

  2. Use the following indentation style

/**
 * Don't forget to write JavaDoc comments.
 */
public void sampleFunction(int x) {
    // leave one space before bracket {
    if (x > 0) { 
        doSomething();
    } else {
        doSomethingElse();
    }
}