Select Page

Ask and it will be given

After I got my first full-time position, everything seemed to go well in life. But after a short while, I didn’t get as much satisfaction from my job as I did at the start. I soon realized that the main problem for me was that being a software engineer is not only about adding new functionality to code, but it is equally important to design it for humans. Whatever code you write in your IDE, your computer will understand it, but it takes much more cognitive work and practice to reach the former.

There was a sense of responsibility and obligation, and the pain of wanting to do better, but I had to figure out how to do that. Fortunately, I discovered a great book called “Java By Comparison”. It is written by several experts in the field of software engineering: Simon Harrer, Jörg Lenhard, and Linus Dietz.


The book promises to teach “clean code” and “best practices” in the Java programming language by thoroughly explaining 70 examples of code. These examples definitely provide a great toolbox to make you a better craftsman, as a lot of ground is covered in those examples. The list of topics includes code style, comments, naming, exceptions, testing, object-oriented design, and functional programming to sharpen the understanding of high-quality code.

Furthermore, the book does a good job of helping to train the brain to internalize the given best practices in real software development. The authors argue that you can view each best practice as an item on a checklist, for example, name things correctly, remove duplication, introduce a guardian, design your objects, use comments wisely, etc.

You can find a concise preview of the contents and comparisons at the book’s official website.

java by comparison map

How to read

In the first reading iteration, it is probably a good idea to read it from start to finish. Later, you can also use it as a “take what you need” resource. Since I started working with the book, I have used it on a daily basis. Especially during the refactoring of legacy codebases, it has helped me a lot.

The wonderful world of chess teaching (let’s not forget that I am still a bit of a chess nerd as well!) uses “chess diagrams” to practice different segments of the game (e.g. tactics) to become familiar with patterns that can occur in any game. In the same way, I like to practice given comparisons while solving programming katas.

Whatever way you choose, make sure to follow yourself.

Remember: Good Design Is Difficult. Hardly anybody gets it right on their first try. In the end, this is good news because it means that your skills will be in high demand when you master object-oriented design. But be aware that it’s harder to tell good from bad design than it is to spot a botched line of code. Good design is less clear-cut, and it requires you to have an intuition and a “feeling” for it. The only real way to get this intuition is to do a lot of coding, try out different designs, and see what fails and what feels just right.
Word by Authors in the chapter Design Your Objects

For Whom?

This is a book for everyone with an interest in coding in JAVA. Whether you are just starting your journey or are a seasoned professional, this book will have something to give to you. Also teachers can use it as a manual as there is a lot of great material to form a course.
Personally, I find the book even useful outside its JAVA domain. The best practices that are advised in the book are applicable in other Object-Oriented languages as well.

Programming is similar to playing games, and it can be just as addictive. It’s real life, so you don’t control a character – you are in the game.
Word by Authors in the chapter Level Up Your Code Style

Key messages

  • If you and your fellow programmers have the intention to rise to a new level of proficiency in programming, to have a mentor or to code cleanly, to form the programming course – this is definitely a book that will be the best friend on that journey.
  • In order to work effectively and efficiently, we all need to cooperate and agree on given rules and Best Practices. It is both exciting and challenging to be part of an industry where standards still need to be defined and where everybody learns from trial and error.

Thank you Simon, Jörg and Linus for your energy and time to write this excellent book.

Share This