四巨头GoF的《设计模式》中23种设计模式的UML图 - 3 of 4

本文详细介绍了设计模式中的原型模式、代理模式、抽象工厂模式、适配器模式、中介者模式、备忘录模式、解释器模式、迭代器模式、桥接模式和建造者模式,通过UML图和关键概念帮助理解各模式的用途和应用场景,旨在降低类之间的耦合度并提高代码的可维护性和扩展性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Prototype: Specify the kinds of objects to create using a prototypical instance, and create new objects by CLONING this PROTOTYPE.


CCOR
1. Creating an object by specifying a class explicitly. 


Proxy: A SUBJECT provides a surrogate or placeholder PROXY for a REAL SUBJECT to control access to it.
 

CCOR
4. Dependence on object representations or implementations. 


*Abstract Factory: An ABSTRACT FACTORY provides an interface for creating families of related or dependent ABSTRACT PRODUCTS without specifying their concrete PRODUCTS.


CCOR
1. Creating an object by specifying a class explicitly. 
3. Dependence on hardware and software platform. 
4. Dependence on object representations or implementations. 
6. Tight coupling. 


*Adapter: ADAPTER converts the interface of an ADAPTEE class into another interface of TARGET class clients expect. ADAPTER lets classes work together that couldn't otherwise because of incompatible interfaces.
 
CCOR
8. Inability to alter classes conveniently. 


Mediator: A MEDIATOR defines a CONCRETE MEDIATOR object that encapsulates how a set of COLLEAGUE objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
 

CCOR
6. Tight coupling. 


Memento: Without violating encapsulation, a CARE TAKER captures and externalizes an ORIGINATOR object's internal state into a MEMENTO so that the ORIGINATOR object can be restored to this state later.
 

CCOR
4. Dependence on object representations or implementations. 


Interpreter: Given a CONTEXT language, an ABSTRACT EXPRESSION defines a represention with a TERMINAL EXPRESSION and a NONTERMINAL EXPRESSION for its grammar along with an interpreter that uses the representation to interpret sentences in the language.



Iterator: An ITERATOR provides a way to access the elements of an AGGREGATE object sequentially without exposing its underlying representation.


CCOR
5. Algorithmic dependencies. 


Bridge: Decouple an ABSTRACTION from its IMPLEMENTOR so that the two can vary independently.


CCOR

3. Dependence on hardware and software platform. 
4. Dependence on object representations or implementations. 
6. Tight coupling. 
7. Extending functionality by subclassing. 


Builder: Separates the construction of a complex object in a DIRECTOR from its representation in a CONCRETE BUILDER so that the same construction process in DIRECTOR can create different representations in CONCRETE BUILDERS.
 
CCOR
5. Algorithmic dependencies. 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值