- 1
- 0
- 约1.03万字
- 约 52页
- 2019-10-27 发布于湖北
- 举报
Abstract Factory Design Pattern Style getComponentA() getComponentB() Client doOperation( Style myStyle ) Style1 getComponentA() getComponentB() Style2 getComponentA() getComponentB() ComponentA ComponentB Style1ComponentA Style1ComponentB Style2ComponentA Style2ComponentB Collection * TP-52 Explains to Abstract Factory Client的doOperation( Style myStyle )方法构建了一个collection实例,例如myStyle是Style1类的对象 myStyle的两个操作将分别产生Style1ComponentA和Style1ComponentB对象 这种模式能够始终确保一个协调的风格! * TP-52 Abstract Factory Design Pattern----Alternative Way Style getComponentA() getComponentB() Client doOperation() Style1 getComponentA() getComponentB() Style2 getComponentA() getComponentB() ComponentA ComponentB Style1ComponentA Style1ComponentB Style2ComponentA Style2ComponentB Collection getComponentA() getComponentB() 没有参数 聚合了Style类 不直接引用Style类 运行时实例化 * TP-52 Summary? What Design Pattern ?? -- class combination and algorithm fulfilling a common design purpose. *通过类的组合和相关算法完成公共的设计目标 ——设计模式 * TP-52 设计模式的特征:观点、角色、层次 1. 客户任务 2. 建立任务 A C A. Static viewpoint B. Dynamic viewpoint 3. 任务:设计模式的应用 D B (i) Abstract level (ii) Concrete level (class model) (sequence or state diagram) : Reference direction * TP-52 设计模式两个观点 静态观点:解决如何创建,由什么创建对象的问题 动态观点:解决怎样发挥模式的功能问题 * TP-52 AntiqueKStyle getWallCabinet() getFloorCabinet() 静态观点(如何创建) KitchenStyle getWallCabinet() getFloorCabinet() ModernKStyle getWallCabinet() getFloorCabinet() WallCabinet FloorCabinet AntiqueWallCabinet AntiqueFloorCabinet FloorCabinet getFloorCabinet() { return new AntiqueFloorCabinet(); } … … FloorCabinet getFloorCabinet() { return new ModernFloorCabinet(); } * TP-52 getWallCabinet() Abstract Factory Application Sequence Diagram myStyle:KitchenStyle Client myStyle: ModernKStyle myStyle: AntiqueKStyle renderKitchen ( myStyle ) wallCabinet1: ModernWallCabinet wallCabinet1: AntiqueWallCabinet ModernWallCabinet() getWallCabinet() AntiqueWallCabinet() myStyle. getWallCabinet() -- IF myStyle BELONGS TO ModernKStyle -- -- IF myS
您可能关注的文档
- AX标准课程资料Rev7_02(操作编).ppt
- B08-地形图的测绘-1.ppt
- B3U5_writing_名词性从句在写作中的应用.ppt
- B3U5-writing-名词性从句在写作中的应用.ppt
- B2C领域中的电子商务数字支付系统.ppt
- bank profitability加拿大著名咨询公司在建设银行的讲座10.ppt
- AT的故障诊断与维修.ppt
- bb平台消化系统.docx
- Ba03Sr07TiO3储能陶瓷的低温烧结及介电性能研究.pptx
- B-Suite供应链管理(SCM)产品规划v30新.ppt
- 统编版2025年春季新版七年级下册历史 第21课 明清时期的科技与文化 教案.docx
- 雅安雨城法院书记员招聘考试真题库2025.docx
- 2026届安徽合肥市高考一模高考语文试卷试题(含答案详解).pdf
- 【专题研究】国内外城市更新研究的最新进展.pdf
- 【专题研究】老旧城区改造居民满意度影响因素研究——以遂宁市老旧城区改造为例.pdf
- 【专题研究】关于旧城空间改造理论与创意设计案例的几点思考.pdf
- 西藏拉萨市高三下学期期末物理备考重点详解.docx
- 泾县法院书记员招聘笔试真题2025.pdf
- 2026年春【苏教版】-六年级数学下册-面积的变化.pptx
- 2026年春【苏教版】-六年级数学下册-7.pptx
原创力文档

文档评论(0)