Renaming /doc to /docs for use with GitHub Pages
[jpf-core.git] / docs / devel / coding_conventions.md
1 # Coding Conventions #
2 JPF is an open system. In order to keep the source format reasonably consistent, we strive to keep the following minimal set of conventions
3
4   * Two space indentation (no tabs)
5   * Opening brackets in same line (class declaration, method declaration, control statements)
6   * No spaces after opening '(', or before closing ')'
7   * Method declaration parameters indent on column
8   * All files start with copyright and license information
9   * All public class and method declarations have preceding Javadoc comments
10   * We use *camelCase* instead of *underscore_names* for identifiers
11   * Type names are upper case 
12
13 The following code snippet illustrates these rules.
14
15 ~~~~~~~~ {.java}
16 /* <copyright notice goes here>
17  * <license referral goes here>
18  */
19
20 /**
21  * this is my class declaration example
22  */
23     
24 public class MyClass {
25    
26   /**
27    * this is my public method example
28    */
29   public void foo (int arg1, int arg2,
30                    int arg3) {
31     if (bar) {
32       ..
33     } else {
34       ..
35     }
36   }
37    ..
38 }
39 ~~~~~~~~
40
41 We consider modularity to be of greater importance than source format. With its new configuration scheme, there is no need to introduce dependencies of core classes towards optional extensions anymore. If you add something that is optional, and does not seamlessly fit into an existing directory, keep it separate by adding new directories. The core JPF classes should not contain any additional dependencies to external code.