Our last book was Quarkus in Action. This time, we are diving into Effective Java (3rd Edition) by Joshua Bloch.

If you already write Java and want to write better Java, this book is for you.

Learning a New Language (Spoken or Programmed)

The author starts with a simple analogy: when learning a second language, you need three things:

  • Grammar
  • Vocabulary
  • Usage

If we translate that to programming:

  • Grammar → Is the language object-oriented? Functional? Imperative? What paradigms does it support?
  • Vocabulary → What does the standard library give you? Collections, concurrency utilities, streams, I/O, etc.
  • Usage → How do experienced developers actually use these tools effectively?

And that last part usage is where this book shines.

  • This is not a tutorial.
  • It won't teach you what a class is.
  • It assumes you already know Java.

Instead, it teaches you how to write code that is:

clear, correct, usable, robust, flexible, and maintainable.

Writing Better Java APIs

Before going further, let's align on something important:

What is an API?

API stands for Application Programming Interface. In the context of a library or framework, it's the set of public classes and interfaces exposed to users. It's your contract with them.

Your API defines:

  • What users can do
  • What they cannot do
  • What they should expect

The author emphasizes a powerful principle:

The user of a component should never be surprised by its behavior.

Whether you're building:

  • A public library
  • An internal company framework
  • A REST client
  • Or even a domain layer

You are designing APIs.

And poor API design is expensive. It leaks into:

  • Backward compatibility problems
  • Confusing abstractions
  • Hard-to-test code
  • Fragile integrations

Effective Java gives you practical, battle-tested rules to avoid that.

The Structure of the Book: 90 Practical Items

The 3rd edition contains 90 items. Each item is a focused rule or recommendation.

What makes this book different:

  • It shows anti-patterns
  • It explains why something is wrong
  • It gives concrete alternatives
  • It discusses trade-offs

It's not dogmatic (Do not do the same thing you do with Clean Code), it's pragmatic.

The First Five Items

We will start with the first five:

  1. Consider static factory methods instead of constructors
  2. Consider a builder when faced with many constructor parameters
  3. Enforce the singleton property with a private constructor or an enum type
  4. Enforce noninstantiability with a private constructor
  5. Prefer dependency injection to hardwiring resources

If you have been working with frameworks like Quarkus, Spring, or Jakarta EE, you have probably seen these principles in action, sometimes without realizing they came straight from this book.

These five items alone already change how you design objects.

Who Is This For?

This book club is for developers who:

  • Already know Java
  • Want to improve API design skills
  • Care about maintainability
  • Enjoy discussing trade-offs
  • Like learning in a group

It is especially valuable if you:

  • Maintain libraries
  • Design reusable modules
  • Work on framework code
  • Care about long-term code quality

Join the Book Club

If reading alone is hard or you just want deeper discussions join us.

📅 February 26th
🕖 19:00 (UTC-3)
📍 Zoom: https://us06web.zoom.us/j/5846506910?omn=88372985611

Author: mcruzdev
3 min read