This is the best design pattern book I have read so far. The examples are interesting (very down to earth, somewhat stupid, but I like them) and the writing is engaging. For me, the gang of four book is quite hard to read since the examples there are detailed and specialized (which don’t really interest me). This book on the other hand is not only informative but also fun to read. I wish I wrote it.

OO Basics

  • abstraction
  • encapsulation
  • polymorphism
  • inheritance

OO Principles

  • identify the aspects of your application that vary and separate them from what stays the same
  • program to an interface (i.e., supertype), not an implementation
  • favor composition over inheritance
  • strive for loosely coupled designs between objects that interact
  • classes should be open for extension, but closed for modification
  • depend upon abstractions. Do not depend upon concrete classes
    • no variable should hold a reference to a concrete class
    • no class should derive from a concrete class
    • no method should override an implemented method of any of its base classes
  • principle of least knowledge - talk only to your immediate friends
    • the object itself
    • objects passed in as a parameter to the method
    • any object the method creates or instantiates
    • any components of the object
  • the Hollywood principle: don’t call us, we’ll call you
  • a class should have only one reason to change