Pay for Hesitation: design_pattern

Pages

顯示具有 design_pattern 標籤的文章。 顯示所有文章
顯示具有 design_pattern 標籤的文章。 顯示所有文章

2010年11月11日 星期四

My Singleton Template

2010年6月18日 星期五

Thinking in Commands

A series of good articles.

2010年6月14日 星期一

Dependency Injection

http://martinfowler.com/articles/injection.html

2010年4月19日 星期一

OO Design Principles


Identify the aspects of your application that vary and separate them from what stays the same.
Favor composition over inheritance.
Strive for loosely coupled designs between objects that interact.
Open-Closed Principle: Class should be open for extension, but closed for modification.
Dependency Inversion Principle: Depend upon abstractions. Do not depend upon concrete classes.
No variables should hold a reference to a concrete class.
No class should derive from a concrete class.
No method should override an implemented method of any of its base class.
Principle of Least Knowledge - talk only to your immediate friends. (It means when you are designing a system, for any object, be care of the number of classes it interacts with and also how it comes to interact with those classes.)

The Hollywood Principle: Don't call us, we'll call you.

A class should have only one reason to change.

Null Object: A null object is useful when you don't have a meaningful object to return, and yet you want to remove the responsibility for handling null from the client. (p.214, NoComand and p.372 Null Iterator)