Dashboard > Terracotta Developer Documentation > Home > Development Process > Coding > Coding style
  Terracotta Developer Documentation Log In   View a printable version of the current page.  
  Coding style
Added by Nathaniel Harward, last edited by Alex Miller on Jan 24, 2008  (view change) show comment
Labels: 
(None)

Legal

Internally created source code

All source code created by Terracotta employees or external contributors needs to contain the following copyright information at the top of the file:

Copyright (c) 2003-2007 Terracotta, Inc. All rights reserved.

This includes any source files created by Terracotta employees and external contributors, including any scripts/demos/build files/etc. Please make sure you add the correct ending year, in case this is not updated right at the beginning of a new year.

External source code

For any third party components in the Terracotta source tree (e.g., Doug Lea's utilities, any JDK/JRE files, etc.), make sure you retain any original copyright information from the original developer(s), and do not add the above Terracotta copyright. If you have any questions or are unclear about what to do with any given source, please contact the Terracotta legal department.

Formatting

The adopted standard for formatting java source code at Terracotta is a slight modification of the Sun standard. The modifications are described below in terms of Eclipse, but hopefully it should translate reasonably for people using other environments.

Eclipse code formatter instructions

Start with the "Java Conventions" code formatter profile, and modify as follows:

  • Indentation tab
    • "General settings" section
      • "Tab policy" changed from "Mixed" to "Spaces only"
      • "Indentation size": 2
      • "Tab size": 4
    • "Alignment of fields in class declarations" section
      • "Align fields in columns" checked
    • "Indent" section
      • "Statements within 'switch' body" checked
  • "Blank lines" tab
    • "Blank lines within class declarations"
      • "Before field declarations": 0
  • "New Lines" tab
    • "Insert new line" section
      • "in empty anonymous class body" unchecked
  • "Control Statements" tab
    • "'if else'" section
      • "Keep 'then' statement on same line" checked
      • "Keep 'else' statement on same line" checked
      • "Keep 'return' or 'throw' clause on one line" checked
  • "Line Wrapping" tab
    • "Line width and indentation levels" section
      • "Maximum line width": 120
  • Comments tab
    • "General settings" section
      • "Enable header comment formatting" checked
    • "Javadoc comment settings" section
      • "Indent description after @param" unchecked
      • "New line after @param tags" unchecked
      • "Remove blank lines" checked
    • "Line width" section
      • "Maximum line width for comments": 120

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators