Head First Design Patterns - Strategy Pattern

Design Principle:

  • Identify the aspects of your application that vary and sparate them from what stays the same.
  • Program to an interface, not an implementation.
  • Favor composition over inheritance

The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.

Strategy lets the algorithm vary independently from clients that use it.

posted @ 2012-04-25 11:05  qiangzhu  阅读(360)  评论(0编辑  收藏  举报