Effective Java (Third Edition)

Effective Java (Third Edition)

Book not only about Java

  • Almost half of the book is about OOP in general
    • Present since 2001 (the first edition)
  • With code examples specifically in Java

Key Items

  • Item 1: Consider static factory methods instead of constructors
  • Item 9: Prefer try-with-resources to try-finally
  • Item 17: Minimize mutability
  • Item 34: Use enums instead of int constants
  • Item 50: Make defensive copies when needed
  • Item 56: Write doc comments for all exposed API elements
  • Item 62: Avoid strings where other types are more appropriate
  • Item 71: Avoid unnecessary use of checked exceptions
  • Item 73: Throw exceptions appropriate to the abstraction
  • Item 77: Don’t ignore exceptions

Book Organization

The book contains 90 items in total, organized into 11 chapters.

Chapter Items Name Java or generic?
1 N/A Introduction N/A
2 1—9 Creating and Destroying Objects generic (mostly)
3 10—14 Methods Common to All Objects Java-specific
4 15—25 Classes and Interfaces generic
5 26—33 Generics Java-specific
6 34—41 Enums and Annotations Java-specific
7 42—48 Lambdas and Streams Java-specific
8 49—56 Methods generic
9 57—68 General Programming generic
10 69—77 Exceptions generic
11 78—84 Concurrency generic (mostly)
12 85—90 Serialization Java-specific