Difference between revisions of "Coding Conventions"
From TV-Browser Wiki
(Updated code convention page using google translation of http://wiki.tvbrowser.org/index.php/Code-Konventionen ... more to come :-)) |
(MOved signature into comment rather than on main page) |
||
Line 24: | Line 24: | ||
* All class variables to be private, other classes should only be able to access external class data by use of accessors + mutators. | * All class variables to be private, other classes should only be able to access external class data by use of accessors + mutators. | ||
− | <!-- WORK IN PROGRESS W to be filled in from translation of http://wiki.tvbrowser.org/index.php/Code-Konventionen --> | + | <!-- WORK IN PROGRESS W to be filled in from translation of http://wiki.tvbrowser.org/index.php/Code-Konventionen ~~~~ --> |
Latest revision as of 17:18, 10 December 2008
Identifiers
Identifiers should use the following naming conventions
- Identifier names should be written in English.
- Class names are written in Camel Case e.g ProgramFieldType [1]
- Package names are all lowercase e.g util.ui.progress
NB: Previous versions of TV-Browser broke convention and used package names without an inverted organisation name eg tvbrowser.core instead net.sf.tvbrowser.core. Plug-ins may use this convention.
Code Formatting
- Tabs should not be used, the rationale being that different people use different tab lengths making indentation a nightmare.
- Use 2 space indents in place of tabs.
Note: In Eclipse, you can set a preference that spaces be used in place of tabs (Window-> Preferences-> Java> Code Style> Code Formatter-> Edit> Use tab character)
Comments
- All comments should be written in English.
- All public methods, constructors or classes will get a Javadoc comment @param @ @param - and @return tags. When classes in devplugin util and tvdataservice addition to the @since Day.
Note: In Eclipse, you can set warnings to be shown when certain methods are not documented (Window-> Preferences-> Java> compiler> Javadoc).
Architecture
- All class variables to be private, other classes should only be able to access external class data by use of accessors + mutators.