Book Reviews
This book review was submitted by a DenverJUG member as part of the Book Review Program.BOOK DETAILS
Effective Java Programming Language Guide
Author: Joshua BlochPublisher: Addison-Wesley Professional
Publish Date: September 2001
Pages: 252
ISBN: 0201310058
Publisher's Book Description
Review Date: December 2003
REVIEWER
Tom McQueeney is a Denver-based Java architect and developer for Idea Integration, a national consulting company. He was elected as the 2003 Vice President responsible for scheduling speakers and the 2004 President for the Denver Java Users Group.REVIEW
This book helps intermediate Java programmers become advanced Java programmers.Effective Java Programming Language Guide outlines 57 rules to writing better Java, written by a Sun Microsystems developer who wrote and improved many of the libraries that make up the core Java language. The rules evolved from best practices the author developed and learned from other expert Java programmers.
Many of the 57 rules answer questions developers face every day. Should I write a public constructor or provide a static factory method (rule 1)? When should I use inheritance over composition to achieve code reuse (rule 14)? Why use an interface when I know I won't need to subclass, since an abstract class lets me do the same thing and even supply some of the default behavior (rule 16)? What's wrong with returning
null as a signal
that the method couldn't create an array (rule 27)?
When do I need to synchronize access to instance variables (rule 48)?
Can I really avoid synchronizing access to ints
(also rule 48)?
All important questions for programmers. The book's answers avoid dogmatism in favor of explaining the pros and cons of making certain design choices. Joshua Bloch's rules definitely favor one approach, but his explanations and code samples sometimes show when the rules might not apply.
The structure of the book makes learning the rules easy. Each rule is the length of a magazine article -- great for reading casually during breaks from coding, maybe even while sipping a cup of Java. The rules themselves are organized into nine categories to help you find the topic that interests you most:
- Creating and destroying objects
- Methods common to all objects
- Classes and interfaces
- Substitutes for
Cconstructs - Methods
- General programming
- Exceptions
- Threads
- Serialization
Who is this book for? The book is geared toward intermediate Java programmers. The code samples and explanations assume the reader is familiar with Java syntax and how to use standard Java libraries. Although the book was published more than two years ago, which can feel like last century in the ever-evolving Java world, the rules outlined in this book apply to the core Java language and libraries. Nothing in the book feels out of date.
Even though I have been coding in Java for six years, I picked up the book because I had heard so many people praising it for improving their programming practices. And indeed, the book deserves the praise. Some of the rules will be in the "obvious" category for experienced developers. But page after page, I found myself saying, "That's a good technique!"
If you feel you can write Java well but want to learn to write Java really effectively, you owe it to yourself to read this book.
-------
Four chapters from the book are available online from Sun. Those chapters include how properly to use and override methods in
Object,
how to write effective methods,
and general programming tips.
