Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Code Conventions

William Guss edited this page Oct 2, 2013 · 18 revisions

There is a loose set of code conventions that should be followed when contributing to JavaLib. These conventions exist to make the code more readable and consistent.

Brace Style

We put braces on the same line as the statement beginning a code block, like so:

if (true) {  
    doSomething();  
}  

We discourage code blocks that are not contained in braces, except in the case of null checks, like so:
if (obj == null) return;

Class Organization

We organize our classes like follows:

  1. Constants
  2. Fields: private, then protected, then public (public fields discouraged, obviously)
  3. Constructors/Initialization
  4. Disposal
  5. Accessors/Mutators
  6. Methods
  7. Helpers

We organize our code into regions which can be minimized if you have the Coffee-bytes plugin installed in Eclipse. Regions are created as follows:

//region Processing  

//Processing Code Here  
  
//endregion  
Clone this wiki locally