Differences between revisions 6 and 7
Revision 6 as of 2007-03-16 02:58:24
Size: 1463
Editor: 207
Comment: Added a rule about using assert as a poor man's #ifdef __DEBUG of C
Revision 7 as of 2009-09-20 23:00:58
Size: 1463
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Coding conventions for the Apache Trinidad Podling

  • Private members and methods use underscore (_) prefix
  • Package-private use double underscore prefixes.

This is intentionally ugly; we strongly discourage the use of package-private access, and in general recommend everything receive the most limited access possible.

  • Constants can be placed in uninstanciable classes if needed, always access them using fully qualified names. Do NOT use implements on interfaces defining constants, that practice is discouraged. Static imports should not be used either.
  • Constants and attributes are defined at the end of the class files, after methods
  • Constant names are in uppercase, with each words separated with an underscore (standard rule)
  • Method and variable names are in lowercase except for the first letter of every word after the first forming them that should be in uppercase
  • Methods appear in the following order: constructor, public, protected, package, private.

  • Generics are used, but not always. Apache Trinidad (formal ADF Faces) started as a JDK 1.2 codebase, so not used all over the place. We're converting piece-by-piece.
  • no calls to System.out/err.println
  • 2 space indent, no use of tabs allowed at all.
  • Braces are always on new lines
  • Using assert as #ifdef DEBUG (boolean debugEnaled = false; assert debugEnabled = true; if(debugEnabled)//do something) is forbidden.

coding (last edited 2009-09-20 23:00:58 by localhost)