well i finally finished reading book Effective Java by Joshua Bloch (former Google chief Java architect at Google and currently professor at Carnegie Mellon University) and here are my thoughts about this book.
First of all how I got recommendation to read this book?
Onetime at German Java-land conference i met one very senior java developer and he recommended to me to read this book and then later through my career as it consultant I heard a lot of times mentioning of this book by other devs and in December of 2020 I decided to read it from first to last page.
Was it worth it?
I say this book make me even more passionate about Java programming and i gain the deepest insight into Java language feature’s.
What author main message?
The author of this book tried to pick at Java most weakest points like serialization , threads management and side effects of object oriented implementations in Java things like: inheritance , overloading and overriding, Enum class types, access modifiers.
Things which I absolutely disliked in this book:
The examples and the description about Java generics is very verbose and convoluted, with all honesty those topics even I would read again and again and writes some code in order to understand the point which author made in thisbook.
In this book you will find zero reference to unit tests.
I have impression that Joshua Bloch did a lot of work with legacy code, and nowadays Java can be tested through Junit framework , which allow you to catch many , many bugs before they really damage your code base.
This book tries to give you some reasoning and advise on what to do and what not to do in Java, but I think it´s applicable to all programming languages and in reality you don’t need to utilize all language features in order to build your modern Java enterprise application.
Joshua Bloch speaks about mutability in Java and how this is bad and can cause real problems in any software projects and sure on that side I agree and it would be great if he added the functional Java examples into this book, but I think it was too much already to ask for. In my opinion mutability is not necessary evil , but only in the case where software design was done right.
Things which I absolutely liked in this book:
This book definitely shows how to apply certain api implementation’s in the right way, try and catch and garbage collection (dont use finalize 😉 ), really some advises can be very productive and efficient.
The part about String class and the Enum Datatype and understanding that stream and thread don’t work actually good together , then analyzing with JMH http://openjdk.java.net/projects/code-tools/jmh/ and in addition this book answer real hard questions about class extensibility, inheritance and even security, autoboxing, thread and even much more 😉
Whom I recommend this book?
Well I think this book not for newbies, you will just be thrown away by the complexity of language examples.
In my opinion this book for experienced developers , which seek more insight and have developed less trust into Java core api, meaning that they know already that certaint default things in Java, dont work as the JDK Docs describes!
This book wont held your hands and will push you to think about the code in terms , which you previously not thought (this is actually very good)
There some criticism to IDE builders, which i personally dont liked , sure you not always need get and set in your class, but really its cool IDE feature 😉
What did you wished to see in this book?
I really missed the part about unit testing and functional programming in Java, my final impression about this book:
Joshua Bloch don’t use Junit tests in his research and projects, that his design most times is perfect and other people need to advance to his level of knowledge in order to comprehend the great design which he created, this is actually what expected from architects in most tech companies.
In my opinion you can create great code base and software design, but you must rely on unit tests and let them warn you if anything goes besides as expected , sure with Java and other languages some new features always added int language and if you want to use them most efficiently , then you must be able to write test’s for performance benchmarks for those language feature and only then in my opinion you will really know what to use and what not to use.
Summary: Overall interesting book, I think it’s quite good reference material for Java developers and time to time you need to look into this book, but don’t use this book to learn Java if you do this, then you doing yourself a disservice.
As novice you need to grasp Java core language and then later Java API and only then you ready for another level of knowledge.
So if you a java novice , learn the basics and do some real commercial projects and only then get a copy of the Joshua Bloch book and read it and try to apply the knowledge from this book.