 |
The
Elements of Java Style
Vermeulen, Ambler, Bumgardner, Metz, Misfeldt, Shur,
& Thompson
Cambridge University Press, 2000
ISBN: 0-521-77768-2
|
 |
| |
|
|
Overview
The syntax of a programming language tells you what
code it is possible to writewhat the machine will
understand. Style tells you what you ought to writewhat 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
Whites The Elements of Style and Kernighan and
Plaugers The Elements of Programming Style. These
small books work because they are simplea 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 treatmenta series of rulesenabled
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
- It presents proven practices for
writing robust Java code -- this isn't an academic wish list
- It is written by developers for developers -- you can immediately
see how to put these coding guidelines to use
- It increases your productivity during development -- it is easier
to write code when it is written in a consistent manner
- In increases your productivity during maintenance -- you always
have to update your code, and the easier it is to understand the
easier it is to update
- It is short and to the point -- it is paperback-sized and 140
pages in length
- It includes a plethora of source code examples -- you immediately
see how to apply the guidelines
- It includes a summary listing of the guidelines -- you have an
easy to read quick reference
- It explains why each guideline is important -- you gain an
understanding of the principles of writing robust Java code
- It is based on existing industry practices -- it summarizes,
explains, and expands on common Java conventions in use by the
best Java software engineers
A
Closer Look at The Elements of Java Style
The book is organized into 6 major sections:
- 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.
- 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.
- 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.
- 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.
- 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.
- 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 elses 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.
 |
Amazon U.K.
 |
Amazon Canada
 |
Other:
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.
I actively work with clients around the world to
improve their information technology (IT) practices as
both a mentor/coach and trainer. A full
description of what I do, and how to contact me, can be
found here.