Java by Comparison – will help you become a professional (book review)
Java by Comparison – will help you become a professional (book review)

Introduction

Are you a junior or regular developer (especially working in Java), who would like to write high quality code – more readable, understandable and efficient? Or maybe you are a consultant, a senior developer, a teacher and you noticed that the beginner programmers often make the same mistakes?

I have a good news for you – a book that might interest you. It’s „Java by Comparison. Become a Java Craftsman in 70 Examples”, written by Simon Harrer, Jörg Lenhard and Linus Dietz. Published “by professional developers for professional developers”.

Java?

Even if you are not familiar with Java and you are using usually other object-oriented programming languages (like C#), this book is still worth your attention (due to the strong similarities and reference to many paradigms and principles applicable to object-oriented programming).

I think that it would be useful for every person mentioned above:

  • as a guide with valuable tips for developers who want to improve their skills,
  • from the teacher’s level: as a reading for students and a reference point for indicating programming mistakes

How is this book organized?

It contains a description of 70 examples of the most common mistakes along with comparisons of the source code “before” and “after” (showing how to avoid bad practice by doing it differently).

The authors are experienced developers who decided to collect these errors into a form of a book – to save time both for themselves and for students (when they saw the same mistakes made by their students again and again…).

Naming things

There are only two hard things in Computer Science: cache invalidation and naming things.

Phil Karlton

It is worth drawing attention to fact, that each case is well-named, so each person can easily refer to the name of a given problem during discussion.

What’s more, in the examples themselves there are references to other named problems to better illustrate how they differ or how they are similar to each other.

This helps not only students, but also teachers who do not have to explain the same problems each time, but only indicate their names in the book so that the student can study them.

Boring cases? – not there

An interesting fact is that the examples are mostly presented in the context of a trip to Mars. For example the code shows the delivery process of supplies to the space shuttle.

It’s nice to read that form instead of boring, repeated hundreds of times in the scientific community texts such as “we have square class that inherits from a rectangle“.

What’s behind these cases exactly?

You are probably curious in what area this book can strengthen your knowledge. In my opinion, the topics are arranged in order from the basic level (but very important) to more advanced things (but described in the form of simple examples).

The topics are mainly about:

  • code readability (which allows faster understanding of the code by other programmers)
  • simplification of complex conditions and methods
  • avoiding errors related to the “Null” values
  • good practices in designing objects (e.g. immutability)
  • so-called “code symmetry” – for example in the creation of method signatures
  • writing reasonable comments and documentation (JavaDoc)
  • naming conventions in Java
  • business context and domain terminology
  • advice for using “exceptions” properly
  • writing unit tests in a good way
  • tips & tricks for using functional programming in cooperation with imperative approach
  • avoiding side effects of computing operations
  • preparation for a real production environment, including static code analysis tools, continuous integration, logging, etc.

Summary

Java by Comparison” is a good supplement to other popular books about clean code, because it shows the above-mentioned things in a slightly different way. It also affects topics related to the multithreaded code (tips on how to minimize and isolate it).

What I liked personally after reading this book is that it contains links to other books and articles for people who want to deepen their knowledge on the topic even more. These are, in my opinion, good reference points for further development and really worth reading (especially “classic” books).

I was positively surprised by the content of this book and I definitely recommend it – a must-read for every Java programmer.

Where to get it?

For instance:

You can see more details there (e.g. customer reviews). The position has its own website: https://java.by-comparison.com/

Mateusz Palichleb

Blog author

I am a experienced programmer in building web applications (generally I started programming in 2005). I'm always open to conversation about clean code, and interesting programming techniques, whoose can improve our work as developers.

You Might Also Like

Nothing Found

Leave a Reply

Your email address will not be published. Required fields are marked *