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. CM3存储器系统

    1.位带(Bit-Band):如1M的地址都可以用bit访问,然后用32M的地址对应这1M的地址.其中这32M地址的每个字的最低位对应那1M可bit寻址的每个位.

  2. sqlite的事务

    好久没用数据库,知识都忘了,之前用sqlite 逐行insert数据,发现这性能实在是太坑,10w条数据,插入大约花了100来分钟. 后来发现还有事务这么一个东西,可以大幅度降低对io的操作,测试插入 ...

  3. liunx下安装mysql没有初始密码的解决方法

    #/etc/init.d/mysql stop #cd /usr/local/mysql #mysqld_safe --user=mysql --skip-grant-tables --skip-ne ...

  4. Scala学习笔记--List、ListBuffer

    ListBuffer(列表缓冲) ListBuffer类位于  scala.collection.mutable.ListBuffer val buf = new ListBuffer[Int] va ...

  5. Codeforces 486D D. Valid Sets

    http://codeforces.com/contest/486/problem/D 题意:给定一棵树,点上有权值,以及d,要求有多少种联通块满足最大值减最小值小于等于d. 思路:枚举i作为最大的点 ...

  6. java.lang.OutOfMemoryError: unable to create new native thread(转)

    解决 - java.lang.OutOfMemoryError: unable to create new native thread 工作中碰到过这个问题好几次了,觉得有必要总结一下,所以有了这篇文 ...

  7. device tree website

    每一个设备都有相对应的初始化程序,dts的写法可以参照Documentations/devicetree/下面的文档 http://bbs.chinaunix.net/thread-4139331-1 ...

  8. mybatis源代码分析:深入了解mybatis延迟加载机制

    下文从mybatis(3.2.7)延迟加载样例讲起,逐步深入其实现机制. 下面的例子是Student类关联一个Teacher对象,在访问Student对象时,不立即加载其关联的Teacher对象,而是 ...

  9. linux中UUID和LABLE

     一.UUID 第一次看到UUID这个东西,是在Ubuntu系统中看到/boot/grub/grub.cfg中对kernel的配置:linux   /boot/vmlinuz-2.6.31-14-ge ...

  10. Search in Rotated Sorted Array (I, II) 解答

    Question Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 ...