DescribingDesign Patterns

描述设计模式

How do we describe design patterns?Graphical notations, while important and useful, aren't sufficient. They simply capture the end product of thedesign process as relationships between classesand objects. To reuse the design, we must also record the decisions,alternatives, and trade-offs that led to it. Concrete examples are important too,because they help you see the design in action.

我们该如何描述设计模式?图形符号是重要和有用的,永远也不觉得多。它们只是捕捉设计的最终产品进程中类和对象的关系。为了重用设计,这就需要我们必须记录这些决议,替代,权衡。具体的例子是非常重要的,在实际的操作中它会帮助你理解设计

We describe design patterns using aconsistent format. Each pattern is divided into sections according to the followingtemplate. The template lends a uniform structure to the information, making designpatterns easier to learn, compare,

and use.

我们需要用一致的形式来描述设计模式。根据下面的模板把每一个模式分为几部分。模板提供统一的信息结构,使设计模式更容易的学习,比较,和使用。

Pattern Name and Classification

The pattern's name conveys the essence of the pattern succinctly. A good name is vital, because it will become part ofyour design vocabulary. The pattern's classification reflects thescheme we introducein Section

模式名和分类

模式名字简洁地表达了模式的精髓。完美的设计名字是至关重要的,因为它将成为你设计词汇中的一部分。我们将分成几部分介绍设计模式的分类。

Intent

A short statement that answers thefollowing questions: What does the design pattern do? What is its rationaleand intent? What particular design issue or problem does it address?

目的

几个简单的陈述回答了接下来的几个问题:设计模式要做些什么?它的基本原理和目的是什么?它专注于那些特别的设计事件和问题。

Also Known As 其他的称谓

Other well-known names for the pattern, if any.

如果有的话,模式也有其他众所周知的名字

Motivation 动机

A scenario that illustrates a design problem and how the class and object structures in the pattern solve theproblem. The scenario will help you understand the more abstract description ofthe pattern that follows.

解决问题方案是给设计问题添加图片说明和添加在模式中的类和对象结构是如何的图片说明。这个方案会帮助你理解更多的关于以下模式的抽象描述。

Applicability适用性

What are the situations in which the designpattern can be applied?What are examples of poor designs that thepattern can address? How can you recognize these situations?

设计模式可以被应用在那种情况下?设计模式可以解决的设计实例是什么?你是如何识别这种情况的?

Structure 结构

A graphical representation of the classesin the pattern using a notation based on the Object Modeling Technique(OMT) [RBP+91]. We also use interaction diagrams [JCJO92, Boo94] toillustrate sequences of requests and collaborations between objects.Appendix B describes these notations in detail.

基于对象模型技术,在模式中类的图形表示用标记。在对象之间,我们也用交互图表来说明序列的需求和合作。附录B详细的描述了这种标记。

Participants 参与者

The classes and/or objects participating inthe design pattern and their responsibilities.

类和对象参与的设计模式及其责任。

Collaborations 合作

How the participants collaborate to carryout their responsibilities.

参与者是如何合作来履行自己的责任!

Consequences 结果

How does the pattern support itsobjectives? What are the trade-offs and results of using the pattern? Whataspect of system structure does it let you vary independently?

模式是如何支持它的目标?权衡使用模式的结果是什么?系统结构方面各部分是如何实现独立变化的?

Implementation 实现

What pitfalls, hints, or techniques should you be aware of when implementing the pattern? Are therelanguage-specific issues?

当实现这个模式的时候,你是否意识到有意想不到的困难吗?有什么好的建议?有什么好的技巧吗?有特定的语言问题吗?

Sample Code 代码示例

Code fragments   that illustrate how you might implement thepattern in  C++ or Smalltalk.

代码片段是用来举例说明你是如何实现c++和smalltalk模式?

Known Uses 应用

Examples of the pattern found in realsystems. We include at least two examples from different domains.

在实际系统中发现模式的好例子。在不同的领域中至少可以发现两个例子?

Related Patterns相关的模式

What design patterns are closely related tothis one? What are the important differences? With which otherpatterns should this one be used?

那些设计模式和这个是相关的?在重要的地方有什么不同?和其他的模式相比这个模式是否可以被用?

The appendices provide backgroundinformation that will help you understand the patterns and the discussions surroundingthem. Appendix A is a glossary of terminology we use. We've already mentionedAppendix B, which presents the various notations. We'll also describe aspects ofthe notations as we introduce them in the upcoming discussions.  Finally, Appendix C contains source code forthe foundation classes we use in code samples.

附录提供的背景信息会帮助你理解这些模式并讨论与之相关的内容。附录A是我们常用的一些专业词汇。我们已经注意到附录B,介绍了各种符号。我们也会描述各方面的符号在以后的讨论中,最后,附录C包含用代码片段做的基本类源代码

DescribingDesign Patterns 描述设计模式的更多相关文章

  1. Streamline Your App with Design Patterns 用设计模式精简你的应用程序

    Back to Design Patterns Streamline Your App with Design Patterns 用设计模式精简你的应用程序 In Objective-C progra ...

  2. Java描述设计模式(24):备忘录模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景 1.场景描述 常见的视频播放软件都具备这样一个功能:假设在播放视频西游记,如果这时候切换播放视频红楼梦,当再次切回播放西游记时, ...

  3. Java描述设计模式(12):外观模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景 1.场景描述 在移动互联网没有普及之前,去饭店吃饭的流程大致如下:选座位,排队,点菜,结账.后来移动互联网普及,通过手机APP就 ...

  4. Java描述设计模式(11):观察者模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.观察者模式 1.概念描述 观察者模式是对象的行为模式,又叫发布-订阅(Publish/Subscribe)模式.观察者模式定义了一种一对多 ...

  5. Java描述设计模式(02):简单工厂模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景简介 1.引入场景 订餐流程简单描述 1).食品抽象类,规定食品的基础属性操作 2).鱼类,鸡肉类食品类扩展 3).订餐流程类,根 ...

  6. 【design patterns】设计模式

    1.单例设计模式(singleton) 用途举例:对于多个程序使用同一个配置信息对象时比如在连接数据库时使用单例模式,每次只取出一个连接 步骤:①私有化该类的构造函数 ②私有化一个静态的对象 ③公有化 ...

  7. Java描述设计模式(15):责任链模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景描述 1.请假审批流程 公司常见的请假审批流程:请假天数 当 day<=3 天,项目经理审批 当 3<day<= ...

  8. Java描述设计模式(16):代理模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景 1.场景描述 在电商高速发展的今天,快递的数量十分庞大,甚至出现了快递代理行业,简单的说就是快递的主人没有时间收快递,会指定一个 ...

  9. Java描述设计模式(17):调停者模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.生活场景 1.场景描述 在公司的日常安排中,通常划分多个部门,每个部门又会分为不同的小组,部门经理的一项核心工作就是协调部门小组之间的工作 ...

随机推荐

  1. C# 微信公众平台开发(3)-- 接受/发送消息

    1.接收事件 关注/取消关注事件: 用户在关注与取消关注公众号时,微信会把这个事件推送到开发者填写的URL. 通过微信返回的XML,我们通过代码 就可以作相应的处理: 先获取返回的信息: if (Ht ...

  2. [Jobdu] 题目1521:二叉树的镜像

    不知道怎么回事下面的代码通过了4个测试用例,还有1个测试用例始终是Runtime Error,各位帮我看一下是哪里出了问题 镜像输出两种方法,一种是递归进行调整,另外一种就是直接在先序遍历的基础上进行 ...

  3. C++之构造函数重载

    #include<stdio.h> class Test    {        private:         int i;         int j;         int k; ...

  4. C++内联函数与宏定义

    用内联取代宏: 1.内联可调试: 2.可进行类型安全检查或自动类型转换: 3.可访问成员变量. 另外,定义在类声明中的成员函数自动转化为内联函数. 文章(一) 内联函数与宏定义 在C中,常用预处理语句 ...

  5. ThinkPHP第十八天(Widget类的使用,连贯操作where IN用法,缓存S函数使用)

    1.Widget类的使用方法: 第一步:在Action同级目录中新建Widget文件夹(独立分组需要自己建立) 第二步:根据不同功能在Widget文件夹中建立不同的Widget类,如热门文章HotWi ...

  6. perl5 第八章 子程序

    第八章 子程序 by flamephoenix 一.定义二.调用  1.用&调用  2.先定义后调用  3.前向引用  4.用do调用三.返回值四.局部变量五.子程序参数传递  1.形式  2 ...

  7. python使用easygui写图形界面程序

    我 们首先下载一个类库easygui,它是一个Python用于简单开发图形化界面的类库,打开easygui的下载网页 http://sourceforge.net/projects/easygui/? ...

  8. cocos2dx中的精灵CCSprite

    什么是精灵(CCSprite),在官网文档中是这么定义的 Sprites A cocos2d CCSprite is similar to sprites you find in other game ...

  9. JAVA的IO学习

    IO 有具体的分类: 有具体的分类:1:根据处理的数类型不同:字节流和字符流.2:根据流向不同:输入流和输出流. =============(补充字节跟字符概念区分)================= ...

  10. 使用Linux静态库

    查看静态库.a文件包含的内容用下面的命令解压: ar x libgdal.a 然后就可以查看文件了: ls adler32.o cpl_recode.o dted_create.o gdalpamra ...