摘要: Design Principle(Open-Closed Principle)Classes should be open for extension, but closed for modification.The Decorator Pattern attaches additional responsibilitis to an object dynamically.Decorator provide a flexible alternative to subclassing for extending functionality.public abstract class Bevera 阅读全文
posted @ 2012-04-25 14:33 qiangzhu 阅读(444) 评论(0) 推荐(0) 编辑
摘要: The Observer Pattern defines a one-to-many dependency between objects so that when oneobject changes state, all of its dependents are notified and updated automatically.The Observer Pattern defines a one-to-many relatioship between objects.Design PrincipleStrive for loosely coupled designs between o 阅读全文
posted @ 2012-04-25 11:33 qiangzhu 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 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 inheritanceThe Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.St 阅读全文
posted @ 2012-04-25 11:05 qiangzhu 阅读(362) 评论(0) 推荐(0) 编辑