23种设计模式

https://blog.youkuaiyun.com/daybreak1209/article/details/21986715

大家都说设计模式可根据目的划分为:

1、创建型(creational):主要用于处理对象的创建,实例化对象

2、结构型(structural):处理类或对象间的组合

3、行为型(behavioral):描述类或对象怎样进行交互和职责分配

   但是让我疑问的是,为什么大家都约定俗成的把n个设计模式分门别类到这三个类别中去呢?分类的具体依据呢?创建型就真的用来创建对象?结构型就组合对象吗?它是怎么创建怎么组合的呢?

   带着这些问题,笔者再度整理了一下思绪,提出几个特征明显的给您娓娓道来~至于针对每一类模式的进一步总结,敬请期待接下来的博文。

 

http://www.dofactory.com/net/design-patterns

序号CreationalPatterns创建模式使用频率 
1Abstract Factory  抽象工厂模式5Creates an instance of several families of classes
2Builder  建造者模式2Separates object construction from its representation
3Factory Method  工厂方法模式5Creates an instance of several derived classes
4Prototype  原型模式3A fully initialized instance to be copied or cloned
5Singleton  单例模式4A class of which only a single instance can exist
    
    
 Structural Patterns结构模式  
6Adapter  适配器模式4Match interfaces of different classes
7Bridge  桥接模式3Separates an object’s interface from its implementation
8Composite  组合模式4A tree structure of simple and composite objects
9Decorator  装饰者模式3Add responsibilities to objects dynamically
10Façade  外观模式5A single class that represents an entire subsystem
11Flyweight  享元模式1A fine-grained instance used for efficient sharing
12Proxy  代理模式4An object representing another object
    
    
 Behavioral Patterns行为模式  
13Chain of Resp  责任链模式2A way of passing a request between a chain of objects
14Command  命令模式4Encapsulate a command request as an object
15Interpreter  解释器模式1A way to include language elements in a program
16Iterator  迭代器模式5Sequentially access the elements of a collection
17Mediator  中介者模式2Defines simplified communication between classes
18Memento  备忘录模式1Capture and restore an object's internal state
19Observer  观察者模式5A way of notifying change to a number of classes
20State  状态者模式3Alter an object's behavior when its state changes
21Strategy  策略者模式4Encapsulates an algorithm inside a class
22Template Method   模板方法模式3Defer the exact steps of an algorithm to a subclass
23Visitor  访问者模式1Defines a new operation to a class without change

转载于:https://www.cnblogs.com/chucklu/p/4543270.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值