Design principles for a better life!

No this is not an “art of living” post where I talk about how you can improve your life with doing more yoga and taking less stress :). I rather wanted to focus on how to reduce the impact of changes in the software system and elaborate the design principles that help reduce the re-work and clutter that usually happens in the later stages of the development cycle .. so a better life for the system and thus for the developer as well ;)

Some of the "must have - must follow" design principles

  1. Encapsulate what varies = Strategy pattern.
  2. Favor Composition over inheritance = Strategy pattern.
  3. Program to interfaces not implementations = Strategy pattern.
  4. Strive for loosely coupled designs between objects that interact = Observer Pattern.
  5. The Open Closed Principle: Classes should be open for extension and closed for modification = Decorator pattern.
  6. Depend on abstracts, do not depend on concrete classes = Factory Pattern.
  7. Only talk to your friends = The Facade Pattern
  8. Always let the higher layers call the lower layer and not vice versa = Template Pattern
  9. The Single responsibility principle – A class should have only one reason to change.

*Inspired from the Head First Design Patterns book