Effective Java 3e

Author: Joshua Bloch
Publisher: Addison Wesley, 2018
Pages: 412
ISBN: 978-0134685991
Print: 0134685997
Kindle: B078H61SCH
Audience: Existing Java programmers
Rating: 5
Reviewer: Alex Armstrong
A third edition of a classic on Java - what could go wrong?

The good news is that in this case "nothing" is the answer. This is still a very good book in a sea of mediocre titles. The first and most important thing to say is that this is not for the beginner. It most certainly doesn't teach you Java. It is a book of best practices and some of the explanations and justification are high level enough to mean that they might go over the head of "just a Java" programmer. You need to have some concern for style and what constitutes good code. I suppose the test is whether or not you are aware that there is more than one way to write almost anything.

Just in case you skipped the Foreword, the following explains what the book is all about:

If a colleague were to say to you, "Spouse of me this night today manufactures the unusual meal in a home. You will join?"  three things would likely cross your mind: third, that you had been invited to dinner; second, that English was not your colleague's first language; and first a good deal of puzzlement.

The author then goes on to say that this is how it often is with programming languages. You might be able to speak Java, but the way that you do it might be more like a second language than something natural. The intention of the book is to explain what seems to be a natural way of expressing things in Java. On the way it also considers and discusses best practices and theories.

Banner

It starts out looking at creating and destroying objects and makes a good case for using object factories among other things. From there on to methods that all objects have and how to override them. Next we have the tension between classes and interfaces when to use which and how exactly. Chapter 5 is a collection of Generics beset practices some obvious, such as prefer lists to arrays, some far from easy to get to grips with. Chapter 6 moves back to an easier topic - enums and annotations. Next come lambdas and streams. Although I'm not sure what they are doing together in a chapter, it is all valuble information.

Chapter 8 is about nothing but methods and Chapter 9 is a general colelction of this and that. The section on not using float or double if you want exact answers is something every programmer should know, not just Java programmers.

Chapter 10 deals with exceptions; Chapter 11 concurrency and the final chapter deals with the easy-sounding, but difficult-in-practice task of serialization.

 

Obviously the book includes many of the same entries as the first and second editions - Java may have changed, but not by that much. This edition covers Java 9, but you really don't need to worry about it becoming obsolete anytime soon. Most of the new features present new problems rather than invalidating old solutions.

Don't buy a copy of this book if you want case studies or long examples. All of the ideas are illustrated by short snippets of code and if you can't see how these generalize to the real world you probably should give up programming. The big problem with this book is that you read it and come away with your head filled with the right way to do things. Some of it sticks and some you forget all too quickly. The solution? Read it again. Just flick though the pages until you see something you don't recognize. Don't buy the Kindle version - its pages don't flick.

If you are a Java programmer, and are going to continue to be a Java programmer, just buy a copy.

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


The Rust Programming Language, 2nd Ed

Author: Steve Klabnik and Carol Nichols
Publisher: No Starch Press
Date: June 2023
Pages: 560
ISBN: 978-1718503106
Print: 1718503105
Kindle: B0B7QTX8LL
Audience: Systems programmers
Rating: 4.8
Reviewer: Mike James

There's a new edition of what has become the standard text on Rust. Has it matured along with [ ... ]



Functional Design (Addison-Wesley)

Author: Robert C. Martin
Publisher: Addison-Wesley
Date: September 2023
Pages: 384
ISBN: 978-0138176396
Print: 0138176396
Kindle: B0CGHQKGYG
Audience: General
Rating: 4.5
Reviewer: Kay Ewbank

This book sets out to explain the principles, patterns and practices of functional design, and why functional prog [ ... ]


More Reviews

Last Updated ( Tuesday, 05 February 2019 )