Difference between revisions of "Style Guide"

From RifidiWiki

Jump to: navigation, search
(Rules for the code)
Line 9: Line 9:
 
*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
 
*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
 
*Synchronizing UI and Model should occur via eclipse databinding and not through direct calls to the viewers
 +
 +
=Comments=
 +
*All methods should have method comments above them.
 +
*All files should have a header with the license that follows this template:
 +
<pre>
 +
/*
 +
*  ${file_name}
 +
*
 +
*  Project: Rifidi - A developer tool for RFID
 +
*  http://www.rifidi.org
 +
*  http://rifidi.sourceforge.net
 +
*  Copyright: Pramari LLC and the Rifidi Project
 +
*  License: Lesser GNU Public License (LGPL)
 +
*  http://www.opensource.org/licenses/lgpl-license.html
 +
*/
 +
</pre>
 +
To have this header generated for you automatically when you create a new file, click Windows->Preferences->Java->Code Style->Code Templates.  Then Click on Comments->Files, and add the header template above.  Now when you create a new file, make sure the box next to "Generate Comments" is checked.

Revision as of 16:14, 8 April 2008

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 Log4J.
  • 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

Comments

  • All methods should have method comments above them.
  • All files should have a header with the license that follows this template:
/*
 *  ${file_name}
 *
 *  Project: Rifidi - A developer tool for RFID
 *  http://www.rifidi.org
 *  http://rifidi.sourceforge.net
 *  Copyright: Pramari LLC and the Rifidi Project
 *  License: Lesser GNU Public License (LGPL)
 *  http://www.opensource.org/licenses/lgpl-license.html
 */

To have this header generated for you automatically when you create a new file, click Windows->Preferences->Java->Code Style->Code Templates. Then Click on Comments->Files, and add the header template above. Now when you create a new file, make sure the box next to "Generate Comments" is checked.

Personal tools