Become a Better Java Developer

Improve your coding skills by comparing your code to that of expert programmers, so you can write code that’s clean, concise, and to the point: code that others will read with pleasure and reuse.

Get hands-on advice to level up your coding style through small and understandable examples that compare flawed code to an improved solution. Discover handy tips and tricks, as well as common bugs an experienced Java programmer needs to know.

Make your way from a Java novice to a decent developer.

Learn more

Become a Better Java Developer in 70 Examples

A Mentor for you

This book is a useful companion for anyone learning to write clean Java code. The authors introduce you to the fundamentals of becoming a software developer, by comparing pieces of problematic code with an improved version, to help you to develop a sense for clean code. This unique before-and-after approach teaches you to create clean Java code.

Code Cleanly

Learn to keep your booleans in check, dodge formatting bugs, get rid of magic numbers, and use the right style of iteration. Write informative comments when needed, but avoid them when they are not. Improve the understandability of your code for others by following conventions and naming your objects accurately. Make your programs more robust with intelligent exception handling and learn to assert that everything works as expected using JUnit5 as your testing framework. Impress your peers with an elegant functional programming style and clear-cut object-oriented class design.

Become a Developer

Writing excellent code isn’t just about implementing the functionality. It’s about the small important details that make your code more readable, maintainable, flexible, robust, and faster. Java by Comparison teaches you to spot these details and trains you to become a better programmer.

What's in the book...

Welcome! (free sample)

Welcome to Java by Comparison! Get ready for code quality.

Start Cleaning Up

Learn the basics of code understandability and start cleaning your code.

Return Boolean Expressions Directly (free sample)

Level Up Your Code Style

Get the quality of your Java code to the next stage.

Use Comments Wisely

Write meaningful comments when they're needed and avoid them when not.

Document Using Examples (free sample)

Name Things Right

Find concise names for your code structures that comply to the conventions.

Prepare for Things Going Wrong

Make your program robust with clean exception handling

Assert Things Going Right

Use JUnit5 to test your code.

Design Your Objects

Apply object-oriented design principles to make your program flexible and maintainable.

Split Method with Boolean Parameters (free sample)

Let Your Data Flow

Leverage the power of lambda expressions and functional programming in Java.

Prepare for the Real World

Use static analyis, build automation and concurrency to release your program into the wild.

Curious? Interested? Get it now!
cover of the book java by comparison

Happy Readers

Profile of Achim Weimert

Achim Weimert

CTO

I wish Java by Comparison had been there when I was getting started with programming, It's like a mentor, looking over your shoulder, and patiently helping you get your programming skills up to the next level.

Profile of Dr. Guido Wirtz

Dr. Guido Wirtz

Professor for Computer Science

This is the book I’ve been waiting for since starting with intermediate Java programming courses. Without dwelling for too long on the basics, Java by Comparison leads you step by step to new insights on good coding practice. Instructive examples compare the do’s and dont’s and make it easy for beginners to get the key points. Here, the book shines and shows it’s based on long-term classroom experience. Luckily, the book can be read as a textbook but is also useful as a reference. I’m looking forward to using it in my classrooms. Are you sure your style is perfect? Get it!

Profile of Ashish Bhatia

Ashish Bhatia

Software Engineer

Java by Comparison is a well-crafted quick read with good, succinct examples updated with the latest Java 8 styling. Highly recommended for Java developers a few years into their career.

Profile of Stefan Tilkov

Stefan Tilkov

CEO

With any language, once you’ve mastered its syntax, the next step is to learn how to use it idiomatically. Whether you’re a beginner who has just started with Java or a seasoned Java developer who started out using one of its many earlier versions, I consider Java by Comparison a great step to become proficient in using Java well.

Profile of Johannes Schwalb

Johannes Schwalb

Java Architect

Java by Comparison is a wonderful read for all those who want to level up their Java skills. It contains the essence of Effective Java and Clean Code, updated with JUnit 5 and Java 8.

Your Authors

Take a closer look into our amazing team. We won’t bite.

Dr. Simon Harrer

Senior Consultant

Simon is a consultant, developer, and teacher who's always looking out for new technologies, frameworks, and ideas. His friends call him a clean code evangelist, but in a good way.

Dr. Jörg Lenhard

Developer

Jörg is a developer, teacher, and researcher. He has been teaching programming in Java for almost a decade and enjoys contributing to open source software.

Linus Dietz

Researcher

Linus is researcher at the Technical University of Munich. His passion lies in developing elegant algorithms and advancing open source software.

Our Book in the Media (Selection)

Our book in University libraries