Intro to Design Patterns Study Note

No matter what you work, what you're building, or what language you are programming in, what's the one true constant that will be with you always ? -- CHANGE

Design Principle  

  1. Identify the aspects of your application that vary and separate them from what stays the same. (从应用程序不变的部分中抽离变化的部分,这样可以只对变化的部分进行改进或者扩展,而不会影响其它不变的部分)
  2. Program to an interface, not an implementation. (借口编程,而非实现编程) 
  3. Favor composition over inheritance. (相对接口,优先选择组成)

OO Basics

  1. Abstraction
  2. Encapulation
  3. Polymorphism
  4. Inheritance

OO Principles

  1. Encapsulate what varies
  2. Favor composition over inheritence
  3. Program to interfaces, not implementations.

OO Patterns

  The Strategy Pattern defines a family of algorithms, encapsulates each one, and make them interchangeable.  <br/>Strategy lets the algorithm vary independently from clients that use it.

posted @ 2012-08-27 10:17  HappyFarmer  阅读(103)  评论(0)    收藏  举报