http://www.spinellis.gr/pubs/Breview/2010-CR-EffectiveJava/html/review.html 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:
|
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.