Book by Joshua Bloch: Effective Java, second edition.

Set of recipes for better designing Java applications. Out of the ones generally pointed by PMD and checkstyle, my favorites:

  • Consider static factory methods instead of constructors (Item 1)
  • Always override toString (Item 10)
  • Minimize mutability (Item 15)
  • Prefer interfaces to abstract classes (Item 18)
  • Use fonction objects to represent strategies (Item 21)
  • Know and use the libraries (Item 47)
  • Avoid strings where other types are more appropriate (Item 50)
  • Use exceptions only for exceptional conditions (Item 57)
  • Throw exceptions appropriate to the abstraction (Item 61)
  • Include failure-capture information in detail messages (Item 63)
  • Consider serialization proxies instead of serialized instances (Item 78)