Coding Conventions

From TV-Browser Wiki
Jump to: navigation, search

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.