In today's post, I want to review the latest technical Java book I read. I came across the book “Java by Comparison” by Simon Harrer, Jörg Lenhard, and Linus Dietz while I was reading Venkat Subramaniam's blog. Venkat did the foreword of this book and as I am a fan of him, I instantly bought the book. Another nice fact about this book is, that some of the authors are living in the surrounding area of my hometown.
The book is about 70 code examples that should boost your Java development skills to become a Java Craftsman. The main reason for writing this book was, that the authors were tired of giving advice to their students for the same code smell over and over again and so they decided to capture all common code smells in one book. Every one of these 70 code examples consists of one page where the “bad” code is presented to the reader to understand the problem and on the next page, they provide a solution for code smell with a solid explanation.
In short, they cover the following topics in their book: the right use of boolean values, using null in your code, working with enums, handling exceptions, commenting your code with JavaDoc, naming, unit testing, object design, Java 8 lambdas, and real world tips for shipping to production. For myself, the chapters about the right usage of JavaDoc and the correct handling of exceptions were most interesting.
The 165 pages of the book were easy to read and every chapter and example was short and meaningful as they provided a short code snippet for every code smell. The targeted audience is every Java developer from junior to senior who wants to master craftsman, by example.
Even if I already followed some of their advice by intuition, it's nice to have an example of a common code smell to e.g. explain it to your co-workers. Besides the book Effective Java and Clean Code, this book is definitely one of the must-reads for every Java developer.
For more testimonials and a free sample, you should visit the official homepage of the book: https://java.by-comparison.com/.
Based on you recommendation I would try and read this book soon.