Java by Comparison: Become a Better Programmer
Java by Comparison: Become a Better Programmer
Summary:
Introduction
The book «Java by Comparison: Become a Better Java Programmer» (authors: Simon Harrer, Jörg Lenhard, Linus Dietz) is a practical guide to writing clean, readable, and maintainable code in Java. Unlike many theoretical works, this book is built on concrete examples: the authors present "bad" code and then show step by step how to improve it. This approach makes the material extremely clear and useful for developers of any level.
What the book is about
The book consists of 11 chapters, each dedicated to a specific aspect of writing quality code. The main topics include:
- Naming variables, methods, and classes
- Structuring conditions and loops
- Working with exceptions and error handling
- Designing APIs and interfaces
- Testing and refactoring
Each chapter contains 5 to 10 "comparisons" — pairs of code examples where a problematic snippet is first demonstrated, followed by its improved version. The authors not only show how to write code but also explain why one approach is better than another, based on SOLID, DRY, KISS principles and commonly accepted practices of the Java community.
Who this book is for
The book is aimed at a wide audience of Java developers:
- Beginners — will learn how to write quality code from the start, avoiding common mistakes.
- Intermediate developers — will be able to systematize their knowledge and discover new refactoring techniques.
- Experienced programmers — will find clear formulations and arguments in the book that can be used during code reviews and when teaching colleagues.
The book does not require deep knowledge of Java — a basic understanding of syntax and object-oriented programming is sufficient.
What the reader will learn
After reading the book, you will be able to:
- Write more readable and self-documenting code
- Avoid common anti-patterns
- Effectively refactor existing code
- Apply SOLID principles in practice
- Improve the structure of conditions and loops
- Handle exceptions properly
- Design clear and reliable APIs
- Write tests that truly verify code behavior
- Argue your decisions during code reviews
Strengths
The main advantage of the book is its practical focus. Each section contains real code examples that can be immediately applied in your work. The authors do not overload the text with theory but concentrate on specific situations that every developer encounters. Additionally, the book is written in a light and accessible language, making it pleasant to read. The structure is also worth noting: each chapter ends with a brief summary, which helps reinforce the material.
Who it is recommended for
The book will be useful for anyone who writes in Java and wants to improve the quality of their code. I especially recommend it to:
- Junior developers who want to move to the next level faster
- Teams that are implementing code reviews and looking for a common language for discussing code
- Teachers and mentors who are looking for clear examples for teaching
If you have already read "Clean Code" by Robert Martin and want to solidify your knowledge with practical examples specifically for Java — this book will be an excellent follow-up.