您的位置:首页 > 其它

不同设计模式解决的问题(完善中。。)

2017-02-06 16:10 225 查看
具体的设计模式,网上有很多介绍。本人参见 journaldev

模式解决问题
BuilderToo Many arguments to pass from client program to the Factory class
Factorywhen we have a super class with multiple sub-classes and based on input, we need to return one of the sub-class
PrototypeWhen u need clone an existing object (shallow or deep copy)
StrategyDefine multiple algorithms and let client application pass the algorithm to be used as a parameter
Decoratormodify the functionality of an object at runtime
CompositeWhen we need to create a structure in a way that the objects in the structure has to be treated the same way
BridgeUsing abstract class replacing implement class to decouple
FacadeUnify a set of interfaces in a subsystem
Template methoddefine common functions in abstract class for all sub class
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  设计模式