Design patterns vary in their granularity and level of abstraction. Because thereare many design patterns, weneed a way to organize them. This section classifies design patterns so that we can refer tofamilies of related patterns. The

classification helps you learn the patternsin the catalog faster, and it can direct efforts to find new patterns aswell.

在抽象的粒度和和水平上,设计模式是多样化。由于有很多的设计模式,我们需要一种组织它们的方法。本节将设计模式分类,以至于我们可以更多地了解哪些相关联的设计模式。这种分类可以帮助你更快的学习这些设计模式。这也对你发现新的设计模式有影响。

We classify design patterns by two criteria(Table 1.1). The first criterion, called purpose, reflects what a patterndoes. Patterns can have either creational,structural, or behavioral purpose.Creational patterns concern the process of

object creation. Structural patterns dealwith the composition of classes or objects. Behavioral patterns characterizethe ways in which classes or objects interact and distribute responsibility.

通过表1.1这两个标准, 我们将设计模式进行分类。第一个标准是目的,反映的是设计模式。模式可以有创造(造物)或结构或行为目的。创造模式关心的是对象创建的进程。结构处理的是类和对象的组成。行为模式的特征是类和对象的相互影响和分类。

The second criterion, called scope,specifies详述,特性 whetherthe pattern applies primarily to classes or to objects. Classpatterns deal with relationships between classes and their subclasses. Theserelationships are established through

inheritance, so they are static—fixed atcompile-time. Object patterns deal with object relationships, which can be changedat run-time and are more dynamic. Almost all patterns use inheritance to someextent. So the only patterns labeled "class

patterns" are those that focus onclass relationships. Note that most patterns are in the Object scope.

第二个标准是规模。提出模式是否应用于类和对象的条件。类模式处理类和子类之间的关系。这些关系已经在继承时确立,因此它是静态固定的编译。对象模式处理对象之间的关系。在执行时它可以被改变,它更多体现动态。在一定程度上,几乎所有的模式都用继承。因此只有“类模式”关注的是类之间的关系。注意更多地模式关注的是对象的规模。

Creational class patterns defer some partof object creation to subclasses, while Creational object patterns defer it toanother object. The Structural class patterns use inheritance to composeclasses, while the Structural object patterns describe ways to assemble objects. TheBehavioral class patterns use inheritance to describe algorithms and flow of control,whereas the Behavioral object patterns

describe how a group of objects cooperateto perform a task that no single object can carry out alone.

创新类模式遵从部分对象到子类,创新对象模式遵从对象到其他的对象。结构类模式用继承来组成类,结构对象描述了组合对象的方法。行为类模式用继承来描述算法和流程控制。在这里行为类模式描述了一组对象合作完成任务,而不是单个对象可以独自执行可完成的。

There are other ways to organize thepatterns. Some patterns are often used together.For example, Composite is often used withIterator or Visitor. Some patterns are alternatives: Prototype is often analternative to Abstract Factory. Some patterns result in similar designs even though thepatterns have different intents. For example, the structure diagrams ofComposite and Decorator are similar.

也有一些其他的方法来组织模式。一些模式经常用在一起。例如,经常将迭代器模式和访问者模式结合在一起用。样板经常继承于抽象工厂模式。即使模式有不同的意图,一些设计却拥有类似的设计。例如,结构图的复合和装饰是相似的。

Yet another way to organize design patternsis according to how they reference each other in their "RelatedPatterns" sections. Figure 1.1 depicts these relationships graphically.

现在,其他的方法来组织设计模式是根据每个相关模式部分是如何引用的。图1.1生动的描述了这种关系。

Clearly there are many ways to organizedesign patterns. Having multiple ways of thinking about patterns will deepen yourinsight into what they do, how theycompare, and when to apply them.

准确的说有很多的方法来组织设计模式。有多个方法思考设计模式会加深你洞察它们是做什么的,会洞察它们是如何被比较,以及在什么时间应用它们。

设计模式 之 Organizing the Catalog 组织目录的更多相关文章

  1. RMAN-使用catalog恢复目录进行备份与恢复

    RMAN ArchitectureThe RMAN architecture, shown in Figure 7-3, includes a target database, repository, ...

  2. Oracle之catalog恢复目录的创建于维护(51CTO风哥rman课程)

    catalog恢复目录配置过程 1,创建一个表空间 2,创建rman用户并授权 3,创建恢复目录 4,配置TNS 5,注册数据库 6,检查 创建ramn表空间 首先查看一下其他表空间位置 create ...

  3. splunk的bucket组织目录——时间序列,按照时间来组织目录

    splunk的bucket组织目录:db_1481515116_1480695302_0db_1481537316_1481532688_1db_1481547598_1481539988_2db_1 ...

  4. RMAN_学习笔记3_RMAN Catalog恢复目录

    2014-12-23 Created By BaoXinjian

  5. Unity 多个Android sdk 插件如何组织目录

    一般Android 插件放在 Assets/Plugins/Android/ 下, 但是一个项目可能要用到多个sdk , 比如既要用 阿里九游的sdk 又要用 share sdk 怎么办呢, 难道要只 ...

  6. Facebook币Libra学习-5.Move组织目录

    Move是一种新的编程语言,旨在为Libra Blockchain提供安全可编程的基础. 组织 Move语言目录由五部分组成: 的虚拟机(VM),其中包含的字节码格式,字节码解释器,和基础设施执行事务 ...

  7. 20 Organizing Go code 组织go代码

    Organizing Go code 16 August 2012 Introduction Go code is organized differently to that of other lan ...

  8. python 设计模式专题(一):目录篇

    一.创建型设计模式 1.工厂模式 2.建造者模式 3.原型模式 二.结构型设计模式(组合) 1.适配器模式 2.装饰器模式 3.外观模式 4.单例模式 5.mvc模式 6.代理模式 三.行为型设计模式 ...

  9. rman catalog (rman 恢复目录)

    受控制文件大小的限制,一般rman需要用rman catalog来管理及存放备份信息: 这里介绍一下创建rman catalog的步骤: C:\Documents andSettings\Admini ...

随机推荐

  1. IntelliJ IDEA14如何配置tomcat

    http://doc.okbase.net/frank1234/archive/121479.html

  2. Django的 select_related 和 prefetch_related 函数对 QuerySet 查询的优化(三)

    4.一些实例 如果我们想要获得所有家乡是湖北的人,最无脑的做法是先获得湖北省,再获得湖北的所有城市,最后获得故乡是这个城市的人.就像这样: 1 2 3 4 5 >>> hb = Pr ...

  3. 使用ARM模板在Azure中国大规模部署DCOS集群

    容器技术是目前非常流行的技术,尤其是在以Docker作为容器引擎的推动下,让容器的轻量级,可移植,自包含,隔离性等的上了一个新的台阶,目前谈及Dev/Ops,CI/CD很少能够绕过Docker的. A ...

  4. iOS中构造函数与析构函数

    一.构造函数 在OC中凡是已init开头的函数我们都称之为构造函数,在声明构造函数的时候,不带参数的一般直接声明为“-(id)init”,带参数的一般声明为“-(id)initWith...”. 1 ...

  5. Linux里如何设置IP(RED HAT)

    一共包括以下两步 1:通过setup命令设置IP 保存…… --如果‘Use DHCP'处事[*],则可能无法手动输入IP,子网掩码和网关. 解决办法: 修改脚本/etc/sysconfig/netw ...

  6. 暴力破解UltraEdit v21 无需注册

    一.复制一份UltraEdit安装目录中的主程序uedit32.exe,到任意目录,用UltraEdit打开复制的uedit32.exe文件. 二.修改以下内容 原来:00094750h: BE DC ...

  7. Keil C51 知识点

    第一节 Keil C51扩展关键字     深入理解并应用C51对标准ANSIC的扩展是学习C51的关键之一.因为大多数扩展功能都是直接针对8051系列CPU硬件的.大致有以下8类: 8051存储类型 ...

  8. linux查看系统版本和系统位数 (转)

    1. uname -ayou will view kernel name.network node hostname.kernel release.kernel version.machine har ...

  9. jsp验证码 (通过单击验证码或超链接换验证码)

    #code.jsp <%@ page language="java" import="java.util.*" import="java.awt ...

  10. {}+[] = ? 和 []+{} = ? 浅谈JS数据类型转换

    参加公司技术嘉年华第一季(前端.服务端)的间隙,陈导问了我一个问题:{}+[] 和 []+{}两个表达式的值分别是什么?根据我的理解我觉得结果应该都是"[object Object]&quo ...