设计模式
来源:互联网 发布:查看监听端口命令 编辑:程序博客网 时间:2024/06/07 11:02
Abstract factory
You want to create objects of a selected family of classes but you don’t want the client to be affected by the choice.
Adapter
You want to convert one interface to another because they do not match and cannot be changed.
Bridge
You want to switch between different implementations at run time without affecting the client.
Builder
You want an abstraction of a process and a set of steps to build a product so that you can combine implementations of the two at run time to produce various categories of products using different processes.
Chain of responsibility
You want to pass a request along a reconfigurable chain of handlers until one that handles it.
Command
You want to encapsulate requests as (command) objects so that you can: (1) delegate the requests to the command objects, (2) queue the requests and execute them at a different time, (3) generate a plan of actions dynamically, and/or (4) stack the requests to support undo and redo.
Composite
You want to represent components with recursive part-whole relationships and allow the client to interact with components and composites uniformly.
Decorator
You want to dynamically add/remove functionality to/from objects.
Facade
You want to simplify a client's interface and interaction to a web of components.
Factory method
You want to create/use objects of a chosen class but you don't want to know, make, or be affected by the choice.
Flyweight
You want to save time and space incurred in the creation, initialization, and storage of many occurrences of an object.
Interpreter
You want dynamic modification of a portion of your program but you don't want to recompile the system.
Iterator
You want a traversal mechanism that hides the structure traversed.
Mediator
You want to replace m-m or component to component interaction with m-1 or component to mediator interaction.
Memento
You want to store and restore the state of an object but you don't want to expose the internals of the state to a third party.
Observer
You want to decouple change and related responses so that you can add or remove such dependencies freely and dynamically.
Prototype
You want to: (1) reduce object creation and initialization costs, (2) reduce number of classes, or (3) use dynamically loaded classes.
Proxy
You want to: (1) hide the use of a remote object, (2) defer creation of an object until it is actually used, (3) control access to an object, or (4) keep track of references or update to an object.
Singleton
You want to create at most one or a limited number of globally accessible instances of a class.
State
You want a low complexity and easy to extend solution to implement a state machine.
Strategy
You want to let the client select an algorithm from available algorithms to accomplish a given task.
Template method
You want the steps of a computation to vary but you don't want to do so with conditional statements.
Visitor
You want to decouple certain functionality from a class structure so that it can be applied to other class structures as well.
龚老师的总结
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式~~~~~~~~~~
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 设计模式
- 关于中文乱码和浏览器图片缓存的问题
- SICP Exercise 4.13
- 解析Hibernate的结构
- 缓存(http://www.infoq.com/cn/articles/misunderstanding-using-cache-2)
- 高效真实的云效果渲染算法
- 设计模式
- 生成随机数
- 【基于连通性的状态压缩DP】【NOI2007】生成树计数
- java异常处理总结
- Apache+Tomcat集群配置详解
- 大小写的转换
- dephi 把按钮作为数组当做对象放入方法中
- 基于Android opengles的魔方开发总结(三)
- 别让所学的东西变成一粒粒的沙子