Java by Comparison Book Review

Have you ever looked back at a piece of code you wrote several months ago and wondered what you were thinking? Could any of your colleagues understand it within a reasonable amount of time? Writing readable code is an essential skill for a programmer. In fact, it’s one of your most important communication skills—it’s your public relations agent and your calling card. It says everything people need to know about your skills as a programmer, and it quickly reveals whether you’re a novice or an expert.” – extract from the book

I always wondered what resources to use if I want to introduce someone to the world of clean code. After reading Java by Comparison by Simon Harrer, Jorg Lenhard & Andrea Stewart I think I have a new favorite to fill in this gap.

Who is this book for?

I think about this book as the first one to read on your journey to become a better developer. Students, interns and junior developers will surely appreciate this book and will notice how a new world emerges for them: the world of clean code and clean architecture. To be frank, the ability to write code that humans can easily follow and understand is a core skill for any software developer. I am not saying that if you have more experience you should not read it, though. You will definitely find useful tips and ideas in the 70 code examples.


Java by Comparison has a pretty cool structure. You have 2 examples for any given problem. One written poorly, the next one written in a clean concise way. Each example is kept short, so it’s really easy to grasp the concept that the example tries to illustrate. From a learning perspective, I think this approach is pretty cool. The code examples are also very fun to read, as they represent a “Mission to Mars” application.


This book is not very long. It has about 170 pages and focuses on the most important clean code techniques that will make an impact for you right now. You will learn:

  • How to name things properly so that your code transmits meaning and intent
  • How to use comments wisely. In fact, the chapter on comments is very comprehensive
  • How to deal with things that go wrong like exception or memory leaks
  • How to write tests that are meaningful and easy to read
  • How to use functional programming via lambdas to simplify your code
  • How to prepare for real world apps by leveraging CI/CD tools, code analysis and common code formatting

Is this enough to learn about clean code?

While the core concepts are covered, I believe that this book is merely the first step in a long journey. To become a software craftsman you will need endless learn-practice cycles. Clean code is about writing applications, so you need to put this theory into practice. Then, as your skills increase, you will pick up other great books on the topic: Clean Code and Clean Architecture by Robert C. Martin, Refactoring by Martin Fowler and Pragmatic Programmer by Andy Hunt and Dave Thomas.


Every journey starts with a single step. If your journey is to become a software craftsman, then the first step is definitely Java by Comparison. If all this sounds appealing, you can go grab the book here: