Java by Comparison (book review)

Java by Comparison review

A couple of weeks ago I have been contacted by Simon Harrer, the first author of Java by Comparison, to write a review about the book. Given the fact that I am both Java and book enthusiast, I accepted the offer. Not to mention that I was curious about how this book could be different from Clean Code by Robert Cecil Martin. However, it took some time to write this review because I did not want to rush into it. And before writing my review, of course, I wanted to read the entire book in depth to ensure nothing has left uncovered. So let’s get started with the Java by Comparison book review.

Introduction to Java by comparison

The book is written by Simon Harrer, Jörg Lenhard, and Linus Dietz. It is targeted for beginner developers.  The purpose of it is to make inexperienced developers aware of their mistakes by providing examples of the bad and good code (before/after approach). I’m a huge fan of this approach.

It’s practical and is a common practice in the software industry. For instance, when reviewing a Pull Request, often the reviewer gives a refactored/better version of the code in the comment along with a short description of why his suggested approach is better. The book follows a similar process. And this makes it perfect for new developers. Because not only they become aware of their errors but also they get a glimpse of how the code review process works.

Additionally, working examples make understanding much easier than some vague abstractions. It’s perfect for pragmatic people like myself.

In regards to the book’s length, I must admit it is pretty concise (only 206 pages). And again I like this aspect of it.

It does not have unnecessary content. And throughout the book, the authors stayed relevant and didn’t diverge from the main topic. They had one goal in mind and they delivered it perfectly. Like Unix philosophy, do one thing and do it well.

The book starts with simple examples and gradually covers more complex cases. It also teaches you how to write correct JUnit tests which is very useful.

One thing that stands out for me is a dedicated chapter (Chapter 8 – Let Your Data Flow) that emphasizes on correct utilizing of Java 8 Functional APIs. This is particularly important, as I found functional programming at first is not intuitive for everyone and it’s good to have a guide to refer to know how to correctly use certain features.

Java by Comparison VS Clean Code

None of these books contracting one another. They complement each other. Clean Code is the more abstract and higher level. It could be more difficult to digest for beginners. Whereas, Java by Comparison, is easier to understand and follow, thanks to its great examples. On the other hand, it covers fewer topics than Clean Code and keeps things minimal.

Pragmatic BookshelfAdditionally, Clean Code examples are written in pseudo-codes, whereas Java by Comparison examples are targeted specifically for Java developers. So it covers correct utilization of some APIs.

Java by Comparison VS Static Code Analyzer

One may say, static code analyzer can do the same as the book. Well not exactly!


Static Code Analyzers often don’t provide examples and the wording could be obscure especially for beginners. I observed this could be a contributing factor why some junior developers keep ignoring the warning of such tools. They find it hard to understand.

The book, on the other hand, provides practical examples and gives a concise and easy to understand reasonings. Hence, it’s perfect for beginners.

Who is this book for?

By now it’s clear that the book is the most suitable for junior/intermediate Java developers. I highly recommend it, especially to junior developers. And it would be good if companies have a few hard copies of this book and Clean Code around. They often come handy.

Who is this book NOT for?

This book may not be suitable for experienced (senior) developers as they are already familiar with most (if not all) of topics the book covers. But skimming through the content doesn’t hurt at all in case you want to ensure you didn’t miss anything.

Does this book makes you a rock star developer?

The short answer is No! Reading this book, or for the fact, any other book is NOT GOOD ENOUGH for anybody to become a good developer. It requires practice and dedication. There is no magic book that makes someone a rock star developer. But this book is a good way to start your journey with. Just keep in mind that you always need to practice what you learned.

Do I recommend this book?

Yes absolutely, I do recommend this book, primarily to junior developers. If you don’t want to get > 50 comments for your first Pull Request (like what happened to me when I started my career) read this book 😉

You can learn many things from it and apply what you learned in your day to day job.

What this book is missing

I was hoping to see more content in the last chapter (Chapter 9 – Prepare for the Real World). I think the authors could have expanded it further as the topics they have touched down are quite important. Although, each topic in that chapter could be a book by itself if not books.

That is all for Java by Comparison book review, for more book reviews check here.

Inline/featured images credits

  • Java by comparison cover page by Simon Harrer, Jörg Lenhard, and Linus Dietz (publisher Pragmatic Bookshelf)
  • Clean Code by Robert C. Martin (publisher Pearson)