Difference between revisions of "Coding conventions"

From PlayOnLinux
Jump to: navigation, search
Line 7: Line 7:
  
 
Example:  
 
Example:  
<pre class='code java'>public abstract class CancelerSynchroneousMessage<RESULT_TYPE> extends SynchroneousMessage implements CancelerMessage {
+
<pre class='code java'>public abstract class CancelerSynchroneousMessage<RESULT_TYPE> extends SynchroneousMessage implements CancelerMessage {
 
     private Boolean processCanceled = false;
 
     private Boolean processCanceled = false;
  

Revision as of 21:17, 7 May 2015

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();
    }
}