随笔 - 134  文章 - 0 评论 - 73 阅读 - 17万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

随笔分类 -  Design Pattern

享元模式
摘要:享元模式 阅读全文
posted @ 2015-07-09 09:48 JustYong 阅读(138) 评论(0) 推荐(0) 编辑
组合模式
摘要:1.定义Compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objec... 阅读全文
posted @ 2015-07-06 23:36 JustYong 阅读(260) 评论(0) 推荐(0) 编辑
命令模式
摘要:1.命令模式为什么存在假如存在一个项目组用于开发一个客户A需求的项目,项目组一共有三个小组,负责不同的工作,Requirement Group(需求组)用于收集用户需求,Page Group(页面组)负责系统页面,Code Group(逻辑组)负责实现具体的功能实现。需求方把任务交待给项目经理,由项... 阅读全文
posted @ 2015-07-06 11:04 JustYong 阅读(254) 评论(0) 推荐(0) 编辑
桥接模式
摘要:1.蜡笔与毛笔的故事(引用自http://www.cnblogs.com/zhenyulu/articles/67016.html)我想大家小时候都有用蜡笔画画的经历吧。红红绿绿的蜡笔一大盒,根据想象描绘出各式图样。而毛笔下的国画更是工笔写意,各展风采。而今天我们的故事从蜡笔与毛笔说起。设想要绘制一... 阅读全文
posted @ 2015-07-01 17:54 JustYong 阅读(262) 评论(0) 推荐(0) 编辑
适配器模式
摘要:1.定义Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn't otherwise becasue of incom... 阅读全文
posted @ 2015-07-01 14:57 JustYong 阅读(398) 评论(0) 推荐(0) 编辑
5.建造者模式
摘要:1.定义Seperate the construction of a complex object from its representation so that the same construction process can create different representations.(... 阅读全文
posted @ 2015-07-01 11:17 JustYong 阅读(415) 评论(0) 推荐(0) 编辑
3.抽象工厂模式
摘要:1.定义Provide an interface for creating families of related or dependent objects without specifying their concrete classes.(为创建一组相关或相互依赖的对象提供一个接口,而且无须指定... 阅读全文
posted @ 2015-07-01 10:01 JustYong 阅读(229) 评论(0) 推荐(0) 编辑
2.工厂方法模式
摘要:1.定义Define an interface for creating an object,but let subclasses decide which class to instantiate.Factory method let a class defer instantiation to ... 阅读全文
posted @ 2015-06-29 23:25 JustYong 阅读(409) 评论(0) 推荐(0) 编辑
1.单例模式
摘要:1.定义Ensure a class has only one instance,and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)2.模式讲解(1)类图(2)单例模式通用代码 1 public... 阅读全文
posted @ 2015-06-23 23:08 JustYong 阅读(244) 评论(0) 推荐(0) 编辑
代理模式
摘要:1.定义Provide a surrogate(代理) or placeholder for another object to control access to it(为其他对象提供一种代理以控制对这个对象的访问)2.模式说明.Subject抽象主题角色抽象主题类可以是抽象类也可以是接口,是一个... 阅读全文
posted @ 2015-06-19 17:30 JustYong 阅读(144) 评论(0) 推荐(0) 编辑
策略模式
摘要:1.定义Define a family of algorithms,encapsulate each one,and make them interchangeable.(定义一组算法,将每个算法都封装起来,并且使它们之间可以互换)2.模式说明Context:封装角色屏蔽高层模块对策略、算法的直接访... 阅读全文
posted @ 2015-06-19 15:59 JustYong 阅读(238) 评论(0) 推荐(0) 编辑
装饰模式
摘要:1.定义Attach additonal responsibilities to an object dynamically keeping the same interface,Decorators provide a flexible alternative to subclassing for... 阅读全文
posted @ 2015-06-19 14:42 JustYong 阅读(358) 评论(0) 推荐(0) 编辑
责任链模式
摘要:1.定义使多个对象都有机会处理请求,从而避免了请求的发送者和接受者之间的耦合关系,将这些对象连成一条链,并沿着这条链传递该请求,直到有对象处理它为止。责任链模式的重点是在"链"上,由一条链去处理相似的请求在链中决定谁来处理这个请求,并返回相应的结果。2.代码实现 public abstract... 阅读全文
posted @ 2015-06-19 11:37 JustYong 阅读(369) 评论(0) 推荐(0) 编辑
观察者模式
摘要:1.定义观察者模式(Observer Pattern)也叫做发布订阅模式(Publish/subscribe),其定义如下:Define a one-to-many dependency between objects so that when one object changes state,al... 阅读全文
posted @ 2015-06-12 15:18 JustYong 阅读(296) 评论(0) 推荐(0) 编辑
中介者模式
摘要:1.为什么要有中介者模式从上图发现这三个类是彼此关联的,每个类都与其他两个类产生了关联关系。修改后的进销存示意图加入了一个中介者作为三个模块的交流核心,每个模块之间不再相互交流,要交流就通过中介者进行。每个模块只负责自己的业务逻辑,不属于自己的则交给中介者进行处理,简化了各个模块之间的耦合关系。2.... 阅读全文
posted @ 2015-06-12 15:18 JustYong 阅读(290) 评论(0) 推荐(0) 编辑
模板方法模式
摘要:1.定义Define the sleleton of an algorithm in an operation,deferring some steps to subclasses.Template Method lets subclasses redefine certain steps of a... 阅读全文
posted @ 2015-06-12 14:50 JustYong 阅读(159) 评论(0) 推荐(0) 编辑
备忘录模式
摘要:1.定义Without violating encapsulation,capture and externalize an object's internal state so that the object can be restored to this state later.(在不破坏封装性... 阅读全文
posted @ 2015-06-10 17:21 JustYong 阅读(150) 评论(0) 推荐(0) 编辑
4.原型模式
摘要:1.定义Specify the kinds of objects to create using a prototypical instance,and create new objects by copying this prototype.(用原型实例指定创建对象的种类,并且通过拷贝这些原型创建... 阅读全文
posted @ 2015-06-10 17:20 JustYong 阅读(147) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示