The Strategy Pattern

原创 hamo  2007-03-09 10:03  阅读 1,726 views 次

The Strategy Pattern defines a family of algorithms, encapsulates each once, and makes them interchangebale. Strategy lets the algorithm vary independently from clients that use it.

OO Principles:

  • Encapsulate what varies.
  • Favor compostion ove inheritence.
  • Program to interface, not implementation.

Bullet Points:

  • Knowing the OO basics does not make you a great OO designer.
  • Good OO designs are reusable, extensible and maitainable.
  • Patterns are proven object-oriented experience.
  • Patterns don't give you code, the give you general solution to design problems. You apply them to your specific application.
  • Patterns aren't invented, they are discovered.
  • Most patterns and principles address issues of change in software.
  • Most patterns allow some part of system to vary independently of all other parts.
  • We often try to take what varies in a system and encapsulate it.
  • Pattens provide a shared language that can maximize the value of your communication with other developers.
版权声明:本文为原创文章,版权归 hamo 所有,欢迎分享本文,转载请保留出处!