This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:

The document's metadata is available in BibTeX format.

This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder.

Diomidis Spinellis Publications

Copyright © 2008 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or

Book Review: Effective Java (2nd ed.)

Diomidis Spinellis
Athens University of Economics and Business

Bloch J.
Effective Java (2nd ed.)
Prentice Hall PTR, Upper Saddle River, NJ, 2008.
384 pp.

As Guy Steele perceptively argues in the book’s introduction, knowing a language’s syntax and semantics is not enough; one has also to know how to use it effectively. This is the premise behind Bloch’s “Effective Java”. The book is neatly divided into 78 practical and prescriptive items, with titles like “Use EnumSet instead of bit fields”. The items span the whole range of programming-in-the-small, covering the lifetime of objects, common object methods, classes and interfaces, generics, enumerations and annotations, methods, programming in general, exception, concurrency, and serialization. This second edition of the book contains about 20 new items, mainly those associated with Java 1.5 and 1.6 features: generics, enumerations, annotations, variable number of arguments, the for-each loop, and the concurrency utilities. Bloch also reworked the other items, to have the corresponding code take advantage of the new Java facilities. With the exception of the chapter on serialization, which to this reviewer appears a bit parochial in the age of the Hibernate object-relational mapping library and XML document standards, the material is relevant to any beginner or intermediate Java programmer. In fact, some of the advice, like the delightful use of an object Builder to document method calls with too many parameters, is often overlooked even by advanced Java programmers.

The writing is crisp and authoritative, as one would expect from somebody who led the design and implementation of many Java features at Sun, and whose current job title at Google is “Chief Java Architect”. The code examples are clear and easy to follow, while the text also includes key but not excessive references to more advanced material. The book’s second edition brings the content in-line with the state of the art in modern Java programming, making it essential reading for all Java programmers.