设计模式
一个松
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
设计模式2--装饰模式(the decorator design pattern)
允许多次实现一种方法,避免每次改动代码。没有使用装饰模式:Computer description()Computer new_description()Computer newer_description()使用了装饰模式:Computer description()Computer description()Disk description()翻译 2015-09-11 13:36:02 · 522 阅读 · 0 评论 -
设计模式1--策略模式(the strategy design pattern)
策略模式,在不同事物(抽象类)之间发现共同点,将共同点汇集进一个单独的接口中(interface),将不同点放入到接口的实现中(有几个不同就有几个实现)。在生成不同事物的对象时,将接口的实现实例化,作为参数传给不同的事物。这里说的事物不是Transaction。doTask() {}doTask() {Overriding code}doTask() {More overriding翻译 2015-09-09 13:14:30 · 553 阅读 · 0 评论 -
设计模式6--责任链模式(The chain of responsibility pattern)
如果一个处理不了,就传给链上的小一个来处理。subject notification subject1subject-->object1-->object2-->object3interface HelpInterface{ public void getHelp(int helpConstant);}public class FrontEnd implements翻译 2015-09-11 13:39:41 · 420 阅读 · 0 评论
分享