1 / 77
文档名称:

软件设计模式(一).ppt

格式:ppt   大小:616KB   页数:77页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

软件设计模式(一).ppt

上传人:840122949 2017/8/8 文件大小:616 KB

下载得到文件列表

软件设计模式(一).ppt

相关文档

文档介绍

文档介绍:软件设计模式(二)
潘爱民
.pCourse
内容
复****br/>续:介绍一些重要的模式
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