https://blog.csdn.net/daybreak1209/article/details/21986715
大家都说设计模式可根据目的划分为:
1、创建型(creational):主要用于处理对象的创建,实例化对象
2、结构型(structural):处理类或对象间的组合
3、行为型(behavioral):描述类或对象怎样进行交互和职责分配
但是让我疑问的是,为什么大家都约定俗成的把n个设计模式分门别类到这三个类别中去呢?分类的具体依据呢?创建型就真的用来创建对象?结构型就组合对象吗?它是怎么创建怎么组合的呢?
带着这些问题,笔者再度整理了一下思绪,提出几个特征明显的给您娓娓道来~至于针对每一类模式的进一步总结,敬请期待接下来的博文。
http://www.dofactory.com/net/design-patterns
序号 | CreationalPatterns创建模式 | 使用频率 | |
1 | Abstract Factory 抽象工厂模式 | 5 | Creates an instance of several families of classes |
2 | Builder 建造者模式 | 2 | Separates object construction from its representation |
3 | Factory Method 工厂方法模式 | 5 | Creates an instance of several derived classes |
4 | Prototype 原型模式 | 3 | A fully initialized instance to be copied or cloned |
5 | Singleton 单例模式 | 4 | A class of which only a single instance can exist |
Structural Patterns结构模式 | |||
6 | Adapter 适配器模式 | 4 | Match interfaces of different classes |
7 | Bridge 桥接模式 | 3 | Separates an object’s interface from its implementation |
8 | Composite 组合模式 | 4 | A tree structure of simple and composite objects |
9 | Decorator 装饰者模式 | 3 | Add responsibilities to objects dynamically |
10 | Façade 外观模式 | 5 | A single class that represents an entire subsystem |
11 | Flyweight 享元模式 | 1 | A fine-grained instance used for efficient sharing |
12 | Proxy 代理模式 | 4 | An object representing another object |
Behavioral Patterns行为模式 | |||
13 | Chain of Resp 责任链模式 | 2 | A way of passing a request between a chain of objects |
14 | Command 命令模式 | 4 | Encapsulate a command request as an object |
15 | Interpreter 解释器模式 | 1 | A way to include language elements in a program |
16 | Iterator 迭代器模式 | 5 | Sequentially access the elements of a collection |
17 | Mediator 中介者模式 | 2 | Defines simplified communication between classes |
18 | Memento 备忘录模式 | 1 | Capture and restore an object's internal state |
19 | Observer 观察者模式 | 5 | A way of notifying change to a number of classes |
20 | State 状态者模式 | 3 | Alter an object's behavior when its state changes |
21 | Strategy 策略者模式 | 4 | Encapsulates an algorithm inside a class |
22 | Template Method 模板方法模式 | 3 | Defer the exact steps of an algorithm to a subclass |
23 | Visitor 访问者模式 | 1 | Defines a new operation to a class without change |