Select Page

Ask and it will be given

After I got my first full-time position all went crescendo in life, but after just a little while I didn’t get as much satisfaction from my job as at the start.
Soon I started to realize what was the main problem for me; being a software engineer is not only about adding new functionalities to the code as it is equally important to design it human-first. Whatever code you write in your IDE, your computer will understand it, but it takes way more of cognitive work and practice to reach the former.
There was a sense of responsibility and obligation, the pain of wanting to do better, but I had to figure out a way how to do that.
Luckily I discovered a gem of a 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 Java programming language by thoroughly explaining 70 examples of code. These examples definitely gare 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 understanding of high-quality code.
Furthermore, the book does a good job of helping to train the brain to internalize given best practices in real software development. The authors plea that you can view each best practice as an item on a checklist, e.g. name things right, 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 a first reading iteration probably it is a good idea to read it from start to finish. Later on, you can also use it as a “take what you need”. Since I started to work with the book I have used it on a daily basis. Especially during refactoring legacy codebase, it has helped me a great deal.
The wonderful world of chess teaching (let’s not forget that I am still a bit of a chess nerd as well!) makes use of ‘chess diagrams’ to practice different segments of the game (e.g. tactics) in order to get familiar with patterns that can happen in any game. In the same way, I like to practice given Comparisons while problem-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.