research emorphia
about  |  announcements  |  features  |  information  |  requirements |  installation
tutorials / guides  |  faq |  help |  contributions |  download  |  dev. tools  |  useful links  

Coding Guidelines

The following coding guidelines are considered to be the fundamental rules to be followed when developing code for the FIPA-OS codebase:

  1. Bracketing should be on new lines. e.g:

    public void method1()
    {
    ....
    }

    Rationale: There seems to be a consensus that code is more readable if opening and closing brackets "match".

  2. Instance variables are prefixed with a single underscore. e.g:

    private Object _field1;

    Rationale: A method is needed to distinguish instance variables from local variables. The underscore is an "ugly" feature to remind people about the importance of instance variables (as suggest by Doug Lea's draft coding stds).

  3. Static variables are prefixed by two underscores. e.g:

    private static Object __field1;

    Rationale: Similar to point 2, this distinguishes static variables from other types of variables straight away - it avoids having to search through the source to discover the particular type of variable it is.

  4. Class Names should begin with a Capital letter, with the first letter of every word being capitalised too. e.g:

    public class DirectoryFacilitator

    Rationale: This conforms to the Sun Microsystems coding std.

  5. Method Names begin with a lower case letter, the first letter of every word afterwards being capitalised. e.g:

    public void aMethodNameThatConforms()

    Rationale: Sun Microsystems coding std.

  6. All variable names will be in lower case with words being separated by underscores. e.g:

    public void _field1_is_an_example_name;

    Rationale: This makes it quicker to identify variables from method names.

  7. Constants are fully capitalised. e.g:

    public static final int A_CONSTANT = 1;

    Rationale: It's easier to identify constants this way.

  SourceForge
webmaster@emorphia.com © emorphia Ltd 2003. All rights reserved.
Last updated 18-Mar-2003
about us customers & partners friday