发布时间:2018-08-29 04:14:28
原文地址:http://www.oodesign.com/decorator-pattern.htmlDecorator PatternMotivationExtending an object?s functionality can be done statically (at compile time) by using inheritance however it might be necessary to extend an object?s functionality dynamically (at r.........【阅读全文】
发布时间:2018-08-29 04:13:34
原文地址:http://www.oodesign.com/composite-pattern.htmlComposite PatternMotivationThere are times when a program needs to manipulate a tree data structure and it is necessary to treat both Branches as well as Leaf Nodes uniformly. Consider for example a program tha.........【阅读全文】
发布时间:2018-08-29 04:12:47
原文地址:http://www.oodesign.com/bridge-pattern.htmlBridge PatternMotivationSometimes an abstraction should have different implementations; consider an object that handles persistence of objects over different platforms using either relational databases or file sys.........【阅读全文】
发布时间:2018-08-29 04:11:58
原文地址:http://www.oodesign.com/adapter-pattern.htmlAdapter PatternMotivationThe adapter pattern is adapting between classes and objects. Like any adapter in the real world it is used to be an interface, a bridge between two objects. In real world we have adapters for.........【阅读全文】
发布时间:2018-08-29 04:10:54
原文地址:http://www.oodesign.com/null-object-pattern.htmlNull Object PatternMotivationThere are some cases when a system has to use some functionality and some cases when it doesn't. Let's say we have to implement a class that should send the results to a log file .........【阅读全文】