Friday, November 30, 2007

Design Principles To Live By

Object-oriented design and design patterns can seem complex.  There are a lot of ideas and cases to consider.  However, there are a handful of principles that, if followed, will result in code that complies with most if not all of the patterns.  These are the patterns behind the patterns.  In my mind, there are 5.  In the next week or so, I'll be writing a post on each of these.

  1. Encapsulate Variation
  2. Design To Interfaces
  3. Loose Coupling Between Classes
  4. Classes Exhibit High Cohesion
  5. Prefer Composition Over Inheritance

  6. Don't Repeat Yourself [late addition]
I'm sure I've missed a couple.  If I have, let me know.

No comments:

Post a Comment