Difference between revisions of "Style Guide"
From RifidiWiki
(→Rules for the code) |
|||
| (9 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
=Look of the code= | =Look of the code= | ||
| − | + | *We follow the naming conventions http://wiki.eclipse.org/Naming_Conventions | |
| − | + | *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= | =Rules for the code= | ||
| − | *No System.out.println should go into SVN if it is not vital to the application | + | *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 | *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 classes and interfaces should have a description with the author's name and a high level description of what the class or interface does. | ||
| + | *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. | ||
Latest revision as of 19:44, 26 November 2010
Look of the code
- We follow the naming conventions http://wiki.eclipse.org/Naming_Conventions
- 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 classes and interfaces should have a description with the author's name and a high level description of what the class or interface does.
- 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.