Object-oriented design principles

I recently read Head First Design Patterns, and they had a handy set of Object-Oriented design principles that were repeated throughout the book that I wanted to document for reference.

  • Encapsulate what varies.
  • Favor composition over inheritance.
  • Program to interfaces, not implementations.
  • Strive for loosely coupled designs between objects that interact.
  • Classes should be open for extension but closed for modification.
  • Depend on abstractions. Do not depend on concrete classes.
  • “Only talk to your friends.”
  • “Don’t call us, we’ll call you.”
  • A class should only have one reason to change.

Updated:

Comments