《设计模式》、程序结构设计、对象设计、程序结构质量标准
设计模式 程序结构设计 对象设计 对象专职设计 对象 质 的设计:MVC组件设计 对象职能范围的设计 对象间关系设计 对象间静态依赖设计 对象间动态协作设计
挑选对象设计(结构设计)模式的标准——程序高质量
这里有一个有趣的问题,就是,设计模式,例如单例模式,被挑选出来的标准是什么?参考MVC模式,这旨GP程序的逻辑所然 -野鹤鹤 挑选对象设计(结构设计)模式的标准,是最终能得到一个高质量设计的软件程序。这个标准需要再技术化一点 -野鹤鹤 软件程序质量高的表现,在满足功能需求前提下,性能佳,可维护性,可扩展性好
功能设计的质量,与结构设计的质量
Point of view affects one's interpretation of what is and isn't a pattern. 出发点的不同会产生对什么是模式和什么不是模式的理解不同。 For this book we have concentrated on patterns at a certain level of abstraction. 本书中我们将在一定的抽象层次上讨论模式。 The design patterns in this book are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context. 本书中的设计模式是对被用来在特定场景下 解决一般设计问题的类和相互通信的对象的描述。
设计问题 ,与程序结构质量标准
设计模式用来解释 设计问题,所谓设计问题,就是 如何提高程序结构标准 的方法,经验和对象设计与安排
MVC模式
《设计模式》上说,传统 MVC模式 是三个基础设计模式的应用:Observer, Composite, and Strategy EM:我以为 MVC最大的一个设计模式,就是设计了合适的对象,针对GP程序逻辑特性 1 MVC对象结构,是GP特有
对象设计的具体任务内容
##寻找合适的对象 Object-oriented programs are made up of objects. 面向对象程序由对象组成 The hard part about object-oriented design is decomposing a system into objects. The task is difficult because many factors come into play: encapsulation, granularity, dependency, flexibility, performance, evolution, reusability, and on and on. They all influence the decomposition, often in conflicting ways. 面向对象设计最困难的部分是将系统分解成对象集合。因为要考虑许多因素:封装、粒 度、依赖关系、灵活性、性能、演化、复用等等,它们都影响着系统的分解,并且这些因素 通常还是互相冲突的。
多种对象设计(寻找)方法
设计 对象核心质的,是它的计算专业职责,不同的程序功能,会产生不同“质”,例如事务专业,算法专业。
事务逻辑专业对象
You can write a problem statement, single out the nouns and verbs, and create corresponding classes and operations. 你可以写出一个问题描述,挑出名词和动词, 进而创建相应的类和操作; Or you can focus on the collaborations and responsibilities in your system. 或者,你可以关注于系统的协作和职责关系; Or you can model the real world and translate the objects found during analysis into design. 或者,你可以对现 实世界建模,再将分析时发现的对象转化至设计中。
通用的算法对象
Many objects in a design come from the analysis model. But object-oriented designs often end up with classes that have no counterparts in the real world. Some of these are low-level classes like arrays. The abstractions that emerge during design are key to making a design flexible. 设计的许多对象来源于现实世界的分析模型。但是,设计结果所得到的类通常在现实世 界中并不存在,有些是像数组之类的低层类,设计中的抽象对于产生灵活的设计是至关重要的。
For example, objects that represent a process or algorithm don't occur in nature, yet they are a crucial part of flexible designs. The Strategy (315) pattern describes how to implement interchangeable families of algorithms. The State (305) pattern represents each state of an entity as an object. 例如,描述过程或算法的对 象现实中并不存在,但它们却是设计的关键部分。 S t r a t e g y ( 5 . 9 )模式描述了怎样实现可互换的 算法族。 S t a t e ( 5 . 8 )模式将实体的每一个状态描述为一个对象。