ImageVerifierCode 换一换
格式:DOC , 页数:9 ,大小:161.50KB ,
资源ID:971759      下载积分:15 文钱
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,省得不是一点点
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.wenke99.com/d-971759.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(10个经典设计模式定义及图解.DOC)为本站会员(天***)主动上传,文客久久仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知文客久久(发送邮件至hr@wenke99.com或直接QQ联系客服),我们立即给予删除!

10个经典设计模式定义及图解.DOC

1、第 1 页(共 9 页)10 个经典设计模式定义及图解1、 The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.DecoyDuckDecoyDuck()display()FlyBehaviorfly()QuackBehaviorquack() DuckDuck()setFlyBehavior

2、()stQuackehavior()disply()performFly()rfrQuack()swim() flyBehaviorquackBehaviorFakeQuack FlyNoWayfly()FlyRocketPowerdfly()FlyWithingsfly()MalrdDuckMalrdDuck()disply()MuteQuackQuackquack() RedHeadDuckRedHeadDuck()isply() RuberDuckRuberDuck()display()Squeakquack()2、The Observer Pattern defines a one-t

3、o-many relationship between objects so that when one object changes state, all of its dependents are notified and updated automatically.0.*SubjectregisterObserver()removeObserver()notifyObserver()Observerupdate()Each subject canhave many observersupdate() will be called whenthe Subjects state change

4、s.These methods will be called When to register as observers , remove themselves from Being observers, or update allthe observers whenever state changes.For example:第 2 页(共 9 页)SubjectregisterObserver()removeObserver()notifyObserver()Observerupdate()0.*CurentConditions Displayupdate()display()Weathe

5、rDataregisterObserver()removeObserver()notifyObserver() 1DisplayElementdisplay()Statistics Displayupdate()display()Forecast Displayupdate()display()3、The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for exte

6、nding functionality.ConcreteComponentAConcreteDecoratorA ConcreteDecoratorBDecoratorComponentConcreteComponentBFor example:第 3 页(共 9 页)HouseBlendHouseBlend()cost()DarkRoastDarkRoast()cost() SteamedMilkSteamedMilk()getDescription()cost()MochaMocha()getDescription()cost()SoySoy()getDescription()cost()

7、EspresoEspreso()cost()DecafDecaf()cost()Beveragedescription : StringgetDescription()cost() CondimentsgetDescription()#baseWhipWhip()getDescription()cost()4、The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method le

8、ts a class defer instantiation to subclasses.Product CreatorfactoryMethod()otherOperation()ConcreteCreatorfactoryMethod()ConcreteProductFor example:第 4 页(共 9 页)NYFactorycreatePiza() ChicagoFactorycreatePiza()NYStyleChesePizaNYStylePeperoniPizaNYStyleClamPizaNYStyleVegiePizaChicagoStyleCheesePizaChic

9、goStylePeperoniPizaChicagoStyleClamPizaChicagoStyleVegiePizaPizaStoreorderPiza() FactorycreatePiza()5、 The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it.Singletonstatic uniqueInstancestatic getInstance() Holds our one and onlyinstance of Singlet

10、on.You can conveniently accessthe method anywhere?6、The Command Pattern encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.第 5 页(共 9 页)InvokersetComand() Comandexecute()undo()ConcreteComa

11、ndexecute()undo()Receiveraction()public void execute()receiver.action();For example:7、The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldnt otherwise because of incompatible interfaces.第 6 页(共 9 页)Client Targe

12、trequest()Adapterrequest() AdaptespecificRequest()For example:8、The Facade Pattern provides a unified interface to a set of interfaces in a subsystem. Faade defines a higher-level interface that makes the subsystem easier to use.第 7 页(共 9 页)Client FacadeFor example:ClientScrenTheaterLightsPopcornPop

13、erHomeTheaterFacadeTunerCdPlayerAmplifierDvdPlayerProjector9、The Template Method Pattern defines the skeleton of a algorithm in a method, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithms structure.第 8 页(共 9 页)primitiveOperation1();primitiveOperation2();For example:10、The State Pattern allows an object to alter its behavior when its internal state changes.第 9 页(共 9 页)state.handle();For example:

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。