Code Style Guides

This is the general guide to accepted Code Style for all Projects hosted on Clazzes.org. Please adher to it when committing Code, Patches etc. As of writing (Aug 13, 2012), this is a working document. 

Disclaimer: Due to historic reasons, some of the source code in our projects does not adher to this style guide as closely as it should. If you come across such code, feel free to edit it to adher to our standards. Please make sure to add an appropriate commit comment if you do so, such as "Edited to conform to style guides", as mass-editing of files may raise suspicion.

Indentation

Use spaces instead of tabs.

Standard indentation depth is 4 spaces for Java, and 2 spaces for XML/HTML.

Java-Specifics

Always qualify instance fields with .this - if you use Eclipse, you can set the compiler to warn you when you forgot to do so: 

  • From the Menu, select Window -> Preferences
  • In the preferences window, select Java -> Compiler -> Errors/Warnings
  • Under "Code Style" change the value for "Unqualified access to instance field" to "Warning"