软件设计模式C#
Software Design Patterns in C#
设计模式(Design Patterns)是你在实际应用程序开发中,对不断发现的软件设计问题的重复解决方案。设计模式是关于对象的设计和交互,关于对经常出现的软件开发挑战的一些完美和重用的解决方案,也提供了一个交流平台,
“四人帮”(GOF)模式被认为是所有其他模式的基础,23种设计模式分为3类:创建型模式(Creational Pattern),结构型模式(Structural Pattern)和行为型模式(Behavioral Pattern)。
为了让你先起步,这里提供了2种形式的源码:结构方面的(structural)和现实应用方法的(real-world)。结构方面的代码使用模式定义和UML类图中提供的类型名称,而实际应用方面的代码提供了你需要使用模式的真实设计情况。
| Creational Patterns 创建型模式 | |
| Creates an instance of several families of classes |
|
| Separates object construction from its representation |
|
| Creates an instance of several derived classes |
|
| A fully initialized instance to be copied or cloned |
|
| A class of which only a single instance can exist |
|
| Structural Patterns 结构型模式 | |
| Match interfaces of different classes |
|
| Separates an object’s interface from its implementation |
|
| A tree structure of simple and composite objects |
|
| Add responsibilities to objects dynamically |
|
| A single class that represents an entire subsystem |
|
| A fine-grained instance used for efficient sharing |
|
| An object representing another object |
|
| Behavioral Patterns 行为型模式 | |
| A way of passing a request between a chain of objects |
|
| Encapsulate a command request as an object |
|
| A way to include language elements in a program |
|
| Sequentially access the elements of a collection |
|
| Defines simplified communication between classes |
|
| Capture and restore an object's internal state |
|
| A way of notifying change to a number of classes |
|
| Alter an object's behavior when its state changes |
|
| Encapsulates an algorithm inside a class |
|
| Defer the exact steps of an algorithm to a subclass |
|
| Defines a new operation to a class without change |
|
原英文URL:
http://www.dofactory.com/Patterns/Patterns.aspx#list
上述各类模式的链接均提供了简单的解释、UML类图、Structural code(C#)和Real-world code(C#)。