The Elements of Java Style

Vermeulen, Ambler, Bumgardner, Metz, Misfeldt, Shur, & Thompson
Cambridge University Press, 2000    ISBN: 0-521-77768-2

Scott W. Ambler + Associates
    Home  |  Articles  |  Books  |  IT Surveys  |  Podcasts  |  Contact Us  |  Announcements  |  Site Map
Order now!  



The syntax of a programming language tells you what code it is possible to write—what the machine will understand. Style tells you what you ought to write—what the humans reading the code will understand. Code written with a consistent, simple style will be maintainable, robust, and contain fewer bugs. Code written with no regard to style will contain more bugs. It may simply be thrown away and rewritten rather than maintained.

Our two favorite style guides are classics: Strunk and White’s The Elements of Style and Kernighan and Plauger’s The Elements of Programming Style. These small books work because they are simple—a list of rules, each containing a brief explanation and examples of correct, and sometimes incorrect, use. We followed the same pattern in this book. This simple treatment—a series of rules—enabled us to keep this book short and easy to understand. The idea is to provide a clear standard to follow, so programmers can spend their time on solving the problems of their customers, instead of worrying about naming conventions and formatting.

This book was written by a team of senior developers from RogueWave Software and myself. Seven people to write a 140-page book? It must be good!


The Strengths of The Elements of Java Style

A Closer Look at The Elements of Java Style

The book is organized into 6 major sections:

  1. General Principles. While it is important to write software that performs well, many other issues should concern the professional Java developer. All good software performs well. But great software, written with style, is predictable, robust, maintainable, supportable, and extensible. This section presents fundamental principles and practices for writing high-quality code, principles and practices that are built upon through the rest of the book.
  2. Formatting Conventions. This section describes approaches to formatting your code to make it more readable, such as indenting (paragraphing) rules, the proper use of white space, and how to effectively break up long lines. Simple practices that have a big payoff when used consistently.
  3. Naming Conventions. This section presents the standard Java naming conventions for classes, member functions, fields, getter and setter operations, local variables, parameters to member functions, and more. Many development teams waste hours, if not days, arguing about how to name the various aspects of their code. Do you really want to spend your time doing this, or spend it writing code? We've documented the standard naming conventions right here so that you don't have to.
  4. Documentation Conventions. Few programs are so simple, so trivial, that they don't need to be documented. In this section we present a collection of principles and guidelines for writing effective source code documentation.
  5. Programming Conventions. This section presents a collection of tips, techniques, and programming idioms for writing superior Java code. Techniques for improving the performance and efficiency of your code are presented, as well as conventions to improve the readability and quality of your code.
  6. Packaging Conventions.   The section presents a collection of packaging conventions for distributing your Java code.

Who Should Read The Elements of Java Style?

We wrote this book for anyone writing Java code, but especially for programmers who are writing Java as part of a team. For a team to be effective, everyone must be able to read and understand everyone else’s code. Having consistent style conventions is a very good first step. We assume that you already know the basics of Java and object-oriented programming, and that you are interested in writing superior Java code.

How to Obtain The Elements of Java Style

Amazon U.S.

Order now!

Amazon U.K.

Order now!

Amazon Canada

Order now!



Reviews of The Elements of Java Style:

If you're a book reviewer for a magazine or web site feel free to email a request for a review copy to me.


Related Resources

Let Us Help

We actively work with clients around the world to improve their information technology (IT) practices, typically in the role of mentor/coach, team lead, or trainer.  A full description of what we do, and how to contact us, can be found at Scott W. Ambler + Associates