Skip to main content

25 docs tagged with "Design"

View all tags

Adapter

适配器通过内部使用新接口规定的属性/方法, 创建一个外观与旧接口一致的方法

Bridge

Split large class or set of closely related classes into two separate hierarchies:

Builder

Flexible object creation with chain style calls.

Command

需要向某些对象发送请求:

Composite

- 封装: 组合模式将对象组合成树形结构, 以表示 部分+整体 的层次结构.

Decorator

- 重写/重载/扩展对象原有的行为 (Methods), 但不改变对象原有属性.

Flyweight

减小内存开销 (Performance Optimization):

IoC and DI

- IoC (Inversion of Control) 控制反转模式: 将组件间的依赖关系从程序内部提到外部来管理.

Iterator

一个 Iterator 对象封装访问和遍历一个聚集对象中的各个构件的方法:

Mediator

一个 Mediator 对象封装对象间的协议 (中央集权的控制中心):

Mixin

将多个对象的属性混入同一个对象, 达到继承/扩展/组合的效果.

Observer

- 被观察者 (Subject) 维护一组观察者列表,

Prototype

可以使用原型模式来减少创建新对象的成本:

Proxy

通过一个代理对象:

Pub-Sub

- 发布-订阅模式是借助第三方来实现调度, 发布者和订阅者之间互不感知.

State

一个 State 对象封装一个与状态相关的行为,

Strategy

- 改变对象的内核/算法, 一个 Strategy 对象封装一个算法, 相互可以替换.

Visitor

Separating an algorithm from an object structure on which it operates.