Coding conventions

From PlayOnLinux
Revision as of 21:17, 7 May 2015 by Tinou (talk | contribs)
Jump to: navigation, search

This page contains some coding convention for PlayOnLinux 5.

Naming convention

  • Classes name should start with a capital letter. Each words should be separated with a capital letters
  • Methods and attributes should start with a lower case. Each words should be separated with a capital letters
  • Variable types should be fully written in capital letters. Each words should be separated with a underscore (_)

Example:

public abstract class CancelerSynchroneousMessage<RESULT_TYPE> extends SynchroneousMessage implements CancelerMessage {
    private Boolean processCanceled = false;

    public RESULT_TYPE getResponse() throws InterruptedException, CancelException {
        RESULT_TYPE response = (RESULT_TYPE) super.getResponse();

        if(this.processCanceled) {
            throw new CancelException();
        }

        return response;
    }

    public void sendCancelSignal() {
        this.processCanceled = true;
        super.semaphore.release();
    }
}