Skip to content

Java Coding Conventions

Zuozhi Wang edited this page Mar 28, 2017 · 8 revisions

Author: Zuozhi Wang

This document specifies the coding conventions in TextDB 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.

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

  3. 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();
    }
}
Clone this wiki locally