下载此文档

软件设计模式(一).ppt


文档分类:IT计算机 | 页数:约77页 举报非法文档有奖
1/77
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/77 下载此文档
文档列表 文档介绍
软件设计模式(二)
潘爱民
.pCourse
内容
复习
续:介绍一些重要的模式
Structural Patterns
Behavioral Patterns
复习:pattern定义
定义:
特定环境中问题的成功解决方案中的静态、动态结构,以及结构元素相互之间的协作关系
Design patterns represent solutions to problems that arise when developing software within a particular context
关于pattern的研究状况
研究历史
现状
pattern与框架
pattern的分类
粒度
复习:如何描述一个模式
关键要素
Design pattern name,Aliases or Also Known As
Problem,Intent or Goal
Forces,Constraints,Motivation
Context, Applicability
Solution
Structure
Participants
Collaboration
Implementation
Evaluation,Resulting Context,Consequences
Related Patterns
Examples,Known uses
复习:creational patters
Factory Method
本质:用一个virtual method完成创建过程
Abstract Factory
一个product族的factory method构成了一个factory接口
Prototype
通过product原型来构造product,Clone+prototype manager
Builder
通过一个构造算法和builder接口把构造过程与客户隔离开
Singleton
单实例类型,如何构造这单个实例?如何访问这单个实例?
Finder
把对象的获取过程与客户隔离开
creational patterns小结
了解每一种模式的实质
具体实现的时候可能会有变化情况,或者扩展,或者退化
factory method是基础,abstract factory是它的扩展
factory method、abstract factory、prototype都涉及到类层次结构中对象的创建过程,有所取舍
prototype需要prototype manager
factory method需要依附一个creator类
abstract factory需要一个平行的类层次
根据应用的其他需求,以及语言提供的便利来决定使用哪种模式
creational patterns小结(续)
builder往往适合于特定的结构需要,它所针对的product比较复杂
singleton有比较强烈的物理意义,可以用在许多细微的地方,不一定与类层次关联
finder模式需要有一定范围内的对象管理功能
这些patterns都很常见,有时需要结合两种或者多种模式完成系统中对象的构造过程
Structural Patterns
Adapter
Bridge
Composite
* Decorator
Facade
Flyweight
* Proxy
模式 7: Adapter (一)
Aliases:Wrapper
Intent
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of patible interfaces.
Motivation
Sometimes a toolkit class that's designed for reuse isn't reusable only because its interface doesn't match the domain-specific interface an application requires.
Adapter模式(二)
Applicability:Use the Adapter pattern when
you want to use an existing class, and its interface does not match the one you need.
you want to create a reusable class that cooperates with unrelated or unfo

软件设计模式(一) 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数77
  • 收藏数0 收藏
  • 顶次数0
  • 上传人840122949
  • 文件大小616 KB
  • 时间2017-08-08
最近更新