wiki:devel/coding_conventions

Coding Conventions

JPF is an open system. In order to keep the source format reasonably consistent, we strive to keep the following minimal set of conventions

  • 2 space indentation (no tabs)
  • opening brackets in same line (class declaration, method declaration, control statements)
  • no spaces after opening '(', or before closing ')'
  • method declaration parameters indent on column
  • all files start with copyright and license information
  • all public class and method declarations have preceding Javadoc comments
  • we use camelCase instead of underscore_names for identifiers
  • type names are upper case

The following code snippet illustrates these rules.

/* <copyright notice goes here>
 * <license referral goes here>
 */

/**
 * this is my class declaration example
 */
    
public class MyClass {
   
  /**
   * this is my public method example
   */
  public void foo (int arg1, int arg2,
                   int arg3) {
    if (bar) {
      ..
    } else {
      ..
    }
  }
   ..
}

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.

Last modified 9 years ago Last modified on 08/17/2009 12:02:57 PM