JAWS Coding Guidelines

In order to keep our code consistent and pretty, please use the following guidelines.

* Indenting: Use an indent of 8 space tabs * If you are modifying someone else's code try to keep the coding style similar * C style comments (/* */) and standard C++ comments (//) are both fine. Use of Perl/shell style comments (#) is discouraged. * Please use // TODO: comment to indicate a missing implementation/feature * Tag your buggy code with the comment // FIXME: and the description of the problem * Use a descriptive introduction for any new files, example:

/*<br/>
 * index.php : index page for jaws<br/>
 *<br/>
 * Author: Jonathan Hernandez  <ion@gluch.org.mx><br/>
 *<br/>
 * (c) 2004 JaWs<br/>
 */

 
* Do not put a space after the opening parenthesis and the closing one
// good
$object->method($a);
$array[10] = 'foo';

//bad
$object->method( $a );
$array[ 10 ] = 'foo';
 

* Inside a code block, put the opening brace on the same line as the statement:
// good
if ($a) {
        foo ();
        bar ();
}

// bad
if (a)
{
        foo ();
        bar ();
}
 

* Avoid using unecessary open/close braces, vertical space is usually limited:
//good
if ($a)
        foo ();

//bad
if ($a) {
        foo ();
}
 

* When defining a class/method, use the C style for brace placement, that means, use a new line for the brace, like this:
// good
class foo extends bar
{
        function foo ()
        {
                 // do something
        }
}

// bad
class foo extends bar  {
        function foo () {
                 // do something
        }
}
 

Happy coding! face-wink.png

(Based on this doc by the Mono Team).

ion | Documentation | June 10, 5:48pm