Jump to ratings and reviews
Rate this book

100 Java Mistakes and How to Avoid Them

Rate this book
Dodge the common mistakes that even senior developers make, take full advantage of static analysis tools, and deliver robust and error-free Java code.

Whenever you make a mistake writing Java, it’s almost guaranteed that someone else has made it before! In 100 Java Mistakes and How To Avoid Them you’ll learn about the common and the not-so-common antipatterns, errors, and tricky bits that trip up almost every Java developer.

Inside 100 Java Mistakes and How To Avoid Them you will learn how

Write better Java programs Recognize common mistakes during programming Create fewer bugs and save time for debugging and testing Get help from static analyzers during programming Configure static analysis tools to reduce the number of false reports Extend static analysis tools with custom plugins
Each Java mistake in this handy guide comes with an illustrative code sample, an explanation of why the mistake occurs, and an actionable “ways to avoid this” section to help you dodge the error. Plus, you’ll benefit from useful static analysis sidebars that let you know when mistakes will—and won’t—be spotted by static analysis tools.

Foreword by Cay Horstmann.

About the technology

Minor bugs in development can become major problems in production. It’s much better to spot and fix your mistakes before they get that far! This one-of-a-kind book shines a light on the most common Java slip-ups and shows you exactly how to avoid making them in the first place.

About the book

100 Java Mistakes and How To Avoid Them highlights 100 Java coding errors—from beginner missteps to mistakes even Java experts don’t know they’re making. Each case includes clear examples to show you what to look for and concrete troubleshooting advice. You’ll learn to use static analysis tools like IntelliJ IDEA and SonarLint to ensure you’re consistently delivering exceptional Java, discover how unit tests and defensive coding can keep your code clean, and even learn to write your own bug-busting plugins.

What's inside

Recognize bugs and antipatterns during programming Highly-effective debugging and testing Get help from static analyzers
About the reader

For Java developers of all skill levels.

About the author

Tagir Valeev is a technical lead in JetBrains and a Java Champion. He designed and developed many code inspections for IntelliJ IDEA built-in static analyzer.

The technical editor on this book was Jean-François Morin.

Table of Contents

1 Managing code quality
2 Expressions
3 Program structure
4 Numbers
5 Common exceptions
6 Strings
7 Comparing objects
8 Collections and maps
9 Library methods
10 Unit testing
A Static analysis annotations
B Extending static analysis tools

679 pages, Kindle Edition

Published May 28, 2024

7 people are currently reading
42 people want to read

About the author

Tagir Valeev

1 book5 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
9 (52%)
4 stars
5 (29%)
3 stars
2 (11%)
2 stars
1 (5%)
1 star
0 (0%)
Displaying 1 - 6 of 6 reviews
Profile Image for dantelk.
214 reviews20 followers
July 9, 2024
I believe writing a book is a bold move: By submitting the paper, a narrator claims that they have written some text worth of reading for hours by strangers. I think this book somehow lacked the elegance and 'a-ha' effect I was hoping for. It felt synthetic and unambitious - what you'd expect from a "classic engineering book".

Just as being a great programmer won't make you a good teammate, being a Java champion doesn't make a person a great writer either. I am sure the author has extensive tech knowledge, tough reflecting this on text requires something else.

2 stars is a bit harsh, and if the author was just in the same room as I am in now, probably I wouldn't give the book such a low score. But he's not at Küçükyalı, so here comes the two stars.

I think the main issue is, I felt that the author just opened the list of Sonar issues and starting giving examples from them one by one. Although I've taken some notes, I wouldn't think my thinking about Java OR programming techniques are improved as much as I expected them to after reading 350 pages.
1 review
May 2, 2024
When I picked this book I had the arrogance to think that it would have been just a way to revise concepts I already knew. After all, I have a 20 year experience as java developer! Well, I was wrong. Quite a few of the mistakes described caught me off guard. A big percentage of the remaining mistakes were familiar because I had encountered them in the code bases I had worked on. This is how useful this book is!
I really recommend it, no matter what your proficiency level is: you will be surprised.
The book is very effective both in describing the mistakes and in explaining the countermeasures to avoid them.
I am recommending this book to all my coworkers. If you care about being a top notch java developer, you should read it too.
Profile Image for Dmitry Aleksandrov.
1 review1 follower
October 14, 2023
I spent a few days with the wonderful book “100 Java Mistakes and How to Avoid Them”, written by my good friend Tagir Valeev. He is one of the few guys I know who really can think like a JVM! Definitely one of the best specialists in Java! His puzzler talks are always fun, intriguing, and full of quality knowledge. Now many of them are summarized in this book.
Although I have 20 years of experience with Java, I have still learned a lot from this book, how to use the right tools for certain situations and how to identify corner cases and avoid them.
Highly recommended book for all Java developers!
Profile Image for Andrzej Grzesik.
50 reviews6 followers
July 28, 2024
Good book, joins the recommendation shelf next to "Effective Java" and "Java Puzzlers".

The number of examples, and their consequences, and how to avoid - it's quite thorough.
Someone might say "knew this already" - good for them.
What Tagir gently introduces are some of the APIs which materialised in more recent JDKs - taking a very pragmatic view on how they can help, if available.
Profile Image for Andres Sacco.
28 reviews7 followers
April 30, 2024
A great book to improve the quality of the code and not introduce any mistake
Displaying 1 - 6 of 6 reviews

Can't find what you're looking for?

Get help and learn more about the design.