[Skip to content]

Links

Code Conventions and Style Guides

AmbySoft Coding Standards for Java  Very detailed, served as the foundation for "The Elements of Java Style" (2000)
Cay Horstmann's Java Language Coding Guidelines According to the author, a simplified version of one that has been used with good success both in industrial practice and for college courses (2004)
Code Conventions for the Java Programming Language  A style guide written by Sun, only covers the basics. Often seen as the official reference, though not taken too seriously by Sun itself (1999)
Geosoft Java Programming Style Guidelines  Unlike all other documents mentioned here, comes in an annotated form that makes it easy to use during project code reviews (2004)
Infospheres Java Coding Standard  Provides little discussion, but features interesting Javadoc guidelines (1999)
JavaRanch Java Programming Style Guide  Covers mainly the same ground as the original Sun document, but gives different advice in some areas
Nejug Coding Standards for Java   The most complete and up-to-date Java coding style document we know of. Compiled by the New England Java User Group (2001)
Red Hat J2EE Engineering Standards   Very pragmatical and accessible collection of best practices (2003)

Books

Code Complete   Steve McConnell, Microsoft Press, 2004, ISBN 0735619670
Just like "The pragmatic programmer" a book that should be included in every software engineering library. Devotes a whole chapter to code layout and style
Expert One-on-One J2EE Design and Development   Rod Johnson, Wrox, 2002, ISBN 0764543857
Devotes a whole chapter to design techniques and coding standards for J2EE projects
The Elements of Java Style   Allan Vermeulen, Scott Ambler et. al., Cambridge University Press, 2000, ISBN 0 521 777682
Provides a set of rules for writing Java code that can be used as the Company's coding standard. Falls short on some rules, but overall gives sound advice

Related Software

Artistic Style Source Code Indenter written in C++. Supports C/C++ and Java
BeautyJ Java Source Code Formatter that demonstrates the use of a flexible Java source code framework. Uses a JavaCC generated parser
CheckStyle Java Coding Convention Checker. Uses an ANTLR generated parser
Eclipse Very powerful Java IDE that since version 3.0 ships with a powerful Java Source Code Formatter
FixStyle Code style improver for Java. It currently only sorts modifiers into the order recommended in the Java language specification. Uses a JavaCC generated parser
IntelliJ IDEA Very powerful Java IDE equipped with a powerful Java Source Code Formatter (commercial)
ImportScrubber Java Import Optimizer. Uses BCEL to parse class files
Jacobe Java Source Code Formatter. Written in C, available for Windows and Unix (not Open Source, but free)
Jalopy (Open Source) The predecessor of the commercial Jalopy. Originally written by the founder of TRIEMAX Software (until 1.0b10), now maintained by the community
JCSC Java Coding Convention Checker. Uses a JavaCC generated parser
Jindent Java Source Code Formatter. They advertise it as "the most powerful source code formatter for Java". Uses a JavaCC generated parser (commercial)
JRefactory Java Refactoring Tool that contains a source code formatter. Uses a JavaCC generated parser
Mozart Development Environment Framework for user extensible compilers and development tools
PMD Java source code analyser/checker. Uses a JavaCC generated parser
Polystyle Formerly called Trita and SmartBeautify. Source Code Indenter that - among other languages - supports Java and JSP. Unlike other tools, Polystyle uses sample files that express your favorite coding style for configuration. Written in Java, but compiled to native code (commercial)
QDox Framework for extracting class/interface/method definitions. Uses an JFlex/BYacc/J generated parser
Recoder Source Code Metaprogramming Framework. Uses a JavaCC generated parser
RevJava Review assistant for Java programs. Uses BCEL to parse class files
Transmogrify Java Refactoring Tool that comes with a basic code formatter. Uses an ANTLR generated parser. Seems to be no longer actively maintained

Unless otherwise mentioned, the software is available under an Open Source license (usally GPL or BSD-ish).