Skip to content
John Erik Halse edited this page Oct 29, 2015 · 5 revisions

🚧 This document is a work in progress 🚧

The coding style conventions that OpenWayback should follow is based on the document Sun's Code Conventions for the Java Programming Language. We have loosened some of the requirements and strengthened others. Most important points are listed below.

Code Style

  • Use spaces, not tabs. Tabs should not appear in project source code.
  • Indent 4 spaces per level.
  • (Deviation from Sun recommendations) Lines should not be longer than 100 columns. Sun recommends 80, but screens have grown larger. Since method and variable names shouldn't be abbreviated, lines tend to be broken too frequently if they are only 80 columns.
  • No spaces at end of line
  • Files should end with newline
  • Place the opening bracket for a code block on the same line as the declaration/test expecting a block.
  • Use brackets even when a branch/block is only a single line of code (to provide an additional visual cue, and for robustness if other lines are added later).
  • Prefer longs over ints anywhere a large count of artifacts or large-sized file/range is possible.
  • Prefer 'package private' (i.e. no modifier) over 'private' unless a consideration of potential subclass use suggests direct access will be dangerous.
  • (Deviation from Sun recommendations) It is permissible to declare local variables as close to first use as practical (as opposed to at the start of the enclosing block).
  • (Deviation from some recommendations) Early- and multiple- returns from methods are encouraged to minimize indention-levels, and handle simple or error cases quickly.
  • All classes must have a Javadoc comment. All public and protected methods should have a Javadoc comment. The use of Javadoc comments for other methods is encouraged, especially if they are more than 5 lines long.
  • Do not include @author in class documentation. Since a class might have many edits from different authors, an author annotation for the class doesn't say much. Instead you can use the blame function on GitHub to find who wrote what.
  • Avoid broad catches (of all Exception or all Throwable) where possible. (Testing code and other all-or-nothing situations excepted.)

Tip

This style guide was not enforced from the start and therefor it might sometimes be difficult to sort out real changes from changes in formatting, especially changes in white space. Everywhere on GitHub where there is a diff view (like in pull requests) you can add ?w=1 at the end of the line to ignore changes in white space from the view.

POLLEE online fashion* POLLEE fashion* Small medium bisness digital economy world profile image with GDPR 10 year working on EU staff union member supported working on POLLEE tree 🌴 sitters/ link Or COVID 19 coming al employees teacher after end of road my bisness after honestly hardly working on GDPR with sopported working on organised by POLLEE tree 🌴 sitters/ project: hello world 🌎 Safe in child advisor marketing by all social media with publisher/ Wikipedia pages Pollee search engine Nasiruddin miah* GitHub profile image Nasiruddin miah with everyone side working apple . Microsoft 360 video open Google bisness profile add (POLLEE online fashion) Ur support open my biases return my all employees with after right planning working on everyone very week employees owners live organisation working on with worldwide young group running conference event meeting everything planning stays please me with my working journey Nasiruddin miah (POLLEE online fashion) Google maps * 1 tree 🌴 changing in the world 🌍

Clone this wiki locally