前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >GOF23种设计模式类型、描述和类图(下)

GOF23种设计模式类型、描述和类图(下)

作者头像
田维常
发布2020-02-13 15:53:56
3850
发布2020-02-13 15:53:56
举报

适配器模式

类型:结构

描述: 将一个类的接口变换成客户端锁期待的另一种接口,从而是原本因接口欧不匹配而无法再一起工作的两个类能够在一起工作 。

英文描述:

Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

类图

组合模式

类型:结构

描述: 将对象组合成树形结构以表示“部分-整体”的层次结构,使得用户对单个对象和组合对象的使用具有一致性 。

英文描述:

Compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual object and compositions of objects uniformly.

类图

代理模式

类型:结构

描述: 为其他对象提供一种代理以控制对这个对象的访问 。

英文描述:

Provide a surrogate or placeholder for another object to control access to it.

类图

桥梁模式

类型:结构

描述: 将抽象和实现解耦,使得两者可以独立的变化。

英文描述:

Decouple an abstraction from its implementation so that the two can vary independently.

类图

装饰模式

类型:结构

描述: 动态地给一个对象添加一些额外的职责,就增加功能来说,它相比生成子类更加灵活。

英文描述:

Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclass for extending functionality.

类图

门面模式

类型:结构

描述: 要求一个子系统的外部与其他内部的通信必须通过一个统一的对象进行。门面模式提供高层次的接口,使得子系统更易于使用。

英文描述:

Provide a unified interface to a set of interfaces in a subsystem.Facade defines a higher-level interface that makes the subsystem easier to use.

类图

享元模式

类型:结构

描述: 使用共享对象可以有效地支持大量的细粒度的对象。

英文描述:

Use sharing to support large numbers of fine-grained objects efficiently.

类图

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-01-04,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Java后端技术栈 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档