Style Guide

From RifidiWiki

Revision as of 20:56, 22 February 2008 by Kyle (Talk | contribs)

Jump to: navigation, search

Look of the code

  • All submitted files have to be formated eclipse style (Hit the autoformat Shift-Ctrl-F in eclipse)
  • Run Check Style on the file (use 'Sun Checks (Eclipse)' as check configuration) and eliminate ALL documentation warnings
  • ALL beanproperties and methods MUST be documented.

Rules for the code

  • No System.out.println should go into SVN if it is not vital to the application (Use commons logging from apache). To use the apache logger, make sure that your project has a dependency on org.rifidi.depenedencies. At the top of any class that you wish to use a logger for, place a statement like this, where ClassName is the name of the class:
    	private static Log logger = LogFactory.getLog(ClassName.class);

To use the logger to print out something:

    logger.debug("Message Here");

The output will look like this:

    DEBUG [THREAD_NAME] (ClassName.java:139) - Message Here

Notice that this allows us to know the class name and line number that the message was printed on. This way we can identify where in the code out output is coming from, which helps to prevent "loose" System.out.print calls.


  • All calls to syncExec and asyncExec have to be discussed with the team and should only be used if there is absolutely no way avoiding them
  • Synchronizing UI and Model should occur via eclipse databinding and not through direct calls to the viewers
Personal tools