Difference between revisions of "Coding conventions"

From PlayOnLinux
Jump to: navigation, search
(Created page with "This page contains some coding convention for PlayOnLinux 5. == Naming convention == * '''Classes''' name should start with a capital letter. Each words should be separated...")
(Tag: visualeditor)
 
Line 5: Line 5:
 
* '''Methods''' and '''attributes''' should start with a lower case. 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 (_)  
 
* '''Variable''' '''types''' should be fully written in capital letters. Each words should be separated with a underscore (_)  
Exemple:  
+
 
  public abstract class CancelerSynchroneousMessage<RESULT_TYPE> extends SynchroneousMessage implements CancelerMessage {<br>
+
Example:  
    private Boolean processCanceled = false;<br>
+
  <pre class='code java'>public abstract class CancelerSynchroneousMessage<RESULT_TYPE> extends SynchroneousMessage implements CancelerMessage {
<br>
+
    private Boolean processCanceled = false;
    public RESULT_TYPE getResponse() throws InterruptedException, CancelException {<br>
+
 
        RESULT_TYPE response = (RESULT_TYPE) super.getResponse();<br>
+
    public RESULT_TYPE getResponse() throws InterruptedException, CancelException {
<br>
+
        RESULT_TYPE response = (RESULT_TYPE) super.getResponse();
        if(this.processCanceled) {<br>
+
 
            throw new CancelException();<br>
+
        if(this.processCanceled) {
        }<br>
+
            throw new CancelException();
<br>
+
        }
        return response;<br>
+
 
    }<br>
+
        return response;
<br>
+
    }
    public void sendCancelSignal() {<br>
+
 
        this.processCanceled = true;<br>
+
    public void sendCancelSignal() {
        super.semaphore.release();<br>
+
        this.processCanceled = true;
    }<br>
+
        super.semaphore.release();
}
+
    }
 +
}
 +
</pre>

Revision as of 21:16, 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();
    }
}