Java By Comparison: Become a Java Craftsman in 70 examples

by | Oct 8, 2019 | Book review | 0 comments

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 started to realize what was one of the challenges 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 have received a gem of a book called Java By Comparison. It is written by several experts in the IT industry; Simon Harrer, Jörg Lenhard and Linus Dietz.

What’s the purpose of Java By Comparison?

The book promises to teach ‘Clean Code’ and ‘Best Practices’ in Java by thoroughly 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 Comparison (Best Practice) as an item on a checklist, e.g.:

  • Name things right
  • Remove duplication
  • Introduce a guardian
  • Design your objects – Split Method with Boolean Parameters
  • Use Comments Wisely – Document Using Examples, etc.

java by comparison mind map

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

How you should read it?

In a first reading iteration probably it is a good idea to read it from start to finish. Later on, you can use it as a ‘take what you need.’ Since I started to work with the book, I have used it on a daily basis. I find it especially helpful during refactoring legacy codebase. 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, to try out different designs, and to see what fails and what feels just right. Word by Authors in the chapter Design Your Objects

Who is Java By Comparison for?

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 useful even 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 a 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 which 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’s both exciting and challenging to be part of the 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.

0 0 vote
Article Rating
Would love your thoughts, please comment.x
Share This