Have you ever overridden the equals() method, but not have it work correctly? Do you miss some of the C constructs and wonder how you can do the same thing in JAVA? Have you ever wished you could come up with better design for your classes? Then this book is for you. First, this is definitely not a book for beginners. I�m not saying you have to be a guru to appreciate the material presented. I made a lot of the same mistakes Joshua pointed out in his book early in my JAVA career. For example, the check list for Item 7: Obeying the general contract when overriding equals, will more than pay for the book when you don�t have to spend several hours trying to figure out why your equals() implementation isn�t working. (If my manager is reading this review, let it be known that this book wasn�t available a year ago, and implementing equals() correctly isn�t trivial!) The book is littered with examples of actual design patterns used in the JDK library, and the material is very up-to-date with references to the JDK 1.4. Anyone aspiring to write good JAVA code that others will appreciate reading and maintaining should be required to own a copy of this book. This is one of those rare books where the information won�t become obsolete with subsequent release of the JDK library. A definite must-have for any JAVA developer/programmer. (Peter Tran - Aug 2001)

Got this book last week, and just thought that I would skim the first part of it (I am actually reading a different book right now). The book is written as 50 "capsules" of concepts and suggestions. The first couple were so good that I found myself up to capsule 7 before I could slap my hand and remind myself to read it later. I can't wait until I get to read the rest of this. (I'll let you know how it goes.)

"JavaRanch, where the deer and the Certified play" - David O'Meara

David Weitzman

Ranch Hand

Posts: 1365

posted 15 years ago

Johannes, how can you afford all these books! Computer books are so damn expensive.

Cindy Glass

"The Hood"
Sheriff

Posts: 8521

posted 15 years ago

Noitce that Johannes is NOT doing all of these reviews. He has just volunteered to do the chore of posting the reviews in this forum to start a conversation thread. The actual reviewer is listed at the bottom of each review.

"JavaRanch, where the deer and the Certified play" - David O'Meara

Pauline McNamara

Sheriff

Posts: 4012

6

posted 15 years ago

I was lucky enough to win this book a while back , but put off reading it until I'd made some more progress learning Java. I've recently begun to look through some of the "items", as each of the advice modules are called. I find myself going from one module to another (you don't have to read it in order, it's got excellent cross referencing) and repeatedly thinking "Aha, so THAT'S how (or why) you should do that" or "OK, that makes sense now." It's written succinctly, getting right to the point in very straight-forward style, so you don't have to wade through inches of book - you can get something out of it right away. Each item is relatively short, from 1 or 2 pages to 5 or 6 pages each. The information is practical and there's lot's of examples, both do's and don'ts. As someone going through javaranch's cattle drive, I find it a great companion to the cattle drive lessons (read: nitpicks ). It confirms lots of what we learn there, plus has the space to go into a little more background explanation. Good way to get those good habits down pat. There's a lot of items that I've yet to read, but based on the few I've seen, this book won't be gathering dust on my shelf. And besides, with sample code that uses Jenny's phone number (remember, 867-5309?) he keeps you interested with information AND humor. Great stuff.

Cindy Glass

"The Hood"
Sheriff

Posts: 8521

posted 15 years ago

You know I love great gossip. Especially if it is true gossip about the mistakes that Sun made with Java and the headaches that it took to try to fix some of these problems as told by someone who actually WROTE some of that code and then had to fix it. Sure brings home the point that I don't want to be making similar mistakes in my code with examples that are easy to relate to. Just one more reason that this is a great book to read.

"JavaRanch, where the deer and the Certified play" - David O'Meara

Johannes de Jong

tumbleweed
Bartender

Posts: 5089

posted 14 years ago

Here a review by one of our regular vistors. His real name is David Weitzman but users the alias David Garland here at the JR. Thanks for the review David

Wow. This is not another book that just spouts the specifications at you. This is a must have for serious java programmers. Bloch is actually works at Sun (he wrote the Collections framework for Example), although he is not ashamed to regularly point out JFC design flaws that it's too late to fix. The book features 57 bits of wisdom (with excellent examples, cross-referencing, and pointers to where the JFC does things right and wrong) categorized into ten main sections: Creating and Destroying Objects, Methods Common to All Objects, Classes and Interfaces, Substitues for C Constructs, Methods, General Programming, Exceptions, Threads, and Serialization. Bloch is a Strong proponent of immutable objects, composition over inheritance, and generally robust and well-written code. You don't know what you've been doing wrong until you read this. Even seeminly simple things like making your objects serializable, implementing and equals method, or designing a secure immutable Object aren't as easy as you think (or at least as I thought). This book is up to date, making reference to Java 1.4 in several places. It includes some very Java specific patterns that I know I'll need to refer to again. If you are already comfortable in Java, this book will take you to a new level. [This message has been edited by Johannes de Jong (edited January 02, 2002).]

Axel Janssen

Ranch Hand

Posts: 2166

posted 14 years ago

I bought it by myself. 3 days later I initialized a study group for the book here @work. Hope it will work. Its really for people who want to write easy to maintain, robust and performant code with the Java programming language. And there got to be a lot of people out there who match this category. Just wanted to tell. Axel [ January 10, 2002: Message edited by: Axel Janssen ]

<pre>Author/s : Joshua BlochPublisher : Prentice Hall PTRReview :LinkReviewed by : Michael ErnestRating : 10 horseshoes</pre> This updated edition has plenty to recommend it. The chapter "Substitutes for C Constructs" is replaced by two new ones, "Generics" and "Enums and Annotations." Some existing items are amended to reflect these constructs. Some new ones promote the use of concurrency over traditional Java threads.

All in all, the second edition boasts 78 items compared to the first edition's 57 items. As before, the justifications driving each item are lucid and compelling, and much, much more valuable in my mind when used to assert confidence in a proven technique. I understand some people come to Effective Java as a primer. I can see how it woud be useful as such, but the arguments laid out seem to me more valuable once you've fumbled a bit on your own.

One item ("For instance control, prefer enum types to readResolve") amounts to a retraction; I consider it a sign of strength, that the book has so little to apologize for.

Sometimes you want answers on best practice from the best authority you can find. If you have a better source than Google's Chief Java Architect, share! I remain impressed by and indebted to Bloch for his simple, elegant style. I've been waiting for a long time to read his take on these new topics. Thank you Josh!

<pre>Author/s : Joshua BlochPublisher : Addison-Wesley (Pearson Educational)Review :LinkReviewed by : Campbell RitchieRating : 10 horseshoes</pre> I had been waiting for this 2nd edition for ages, and I have not been disappointed by it.

Everything is there:

* Why you don't concatenate Strings repeatedly * Confusion between "L" and "l" and "1" * How to get floating-point arithmetic wrong * Why you avoid returning null * Why you always use library classes. These few previous points ought to be taught to even the rawest beginner, but the remainder of the book is only suitable for the more experienced programmer. Bloch takes a tour de force through all the features of the language. Some chapters are about general programming, including the methods inherited from java.lang.Object, others about specific features like concurrency.

he book is completely up to date for Java 6. It is clear and easy to read, although dense with information, so one cannot skim through it. Bloch pulls no punches. He tells us the features he likes and which he doesn't. He warns against using finalize() and clone() and calls classes like StringTokenizer, and the older concurrency mechanisms obsolete.

Anybody who wants to understand the workings of the language, to get up to speed and write code which really works: you're not borrowing my copy. Buy your own and you will be really pleased with it. More info at Amazon.com

Campbell Ritchie

Sheriff

Posts: 51447

87

posted 8 years ago

I think I have persuaded our friendly neighbourhood librarian to buy a couple of copies; I was quite surprised there wasn't one there before. [ June 19, 2008: Message edited by: Campbell Ritchie ]

The second edition of "Effective Java" is almost like a completely different book from the first. There were new chapters addressing Java 5 topics such as generics, enums and autoboxing. Existing patterns were rewritten for Java 5/6 - both conceptually and for the code examples. For example, overloading now address varargs. The number of items grew from 57 to 78 as well and the author removed the old ones that are obsolete.

As a reference, chapter one provided a table to quickly find items on Java 5. The appendix provided a cross mapping to find items from the first edition in this copy.

For those new to "Effective Java", it is meant for intermediate to advanced Java developers. It provides best practices, recipes and idioms for working with Java. The author is good about listing both advantages and disadvantages to choose when to apply a tip.

When thinking about my favorite chapter, I have trouble picking just one. I'm torn between the concurrency and enum chapters. The book goes beyond the common "use enums over constants" and goes into things like EnumBitSets.

I learned a lot reading the first edition of this book and learned just as much reading the second. If you have the first edition, but this one anyway. And if you haven't read the first edition, get your hands on the latest copy!

arulk pillai

Author
Ranch Hand

Posts: 3393

posted 8 years ago

I read the first book "Effective Java". Very impressed by it and learnt a lot about the language. Every developer should own a book like this.

It's one of the books that you want to keep around. Compact and good, that's how the book is. Compared to many books, it's difficult to get bored easily and to be tempted to skip chapters all the time. Like others said this book is a must and it's not expensive too!