[译]OOSE第4章:面向对象系统的研发 4.3 面向对象的分析

4.3 Object-oriented analysis

4.3 面向对象的分析

The purpose of object-oriented analysis, as with all other analysis, is to obtain an understanding of the application: an understanding depending only on the system's functional requirements.

 和其他的分析过程类似,进行面向对象分析的目的是在于对应用领域获得一个良好的理解;而这种从OO过程获得的理解是一种基于系统所提供的功能需求的理解。

The difference between object-oriented analysis and function/data analysis is, as previously mentioned, the means of expression. While function/data analysis methods commence by considering the system's behavior and/or data separately, object-oriented analysis combines them and regards them as integrated objects. Object-oriented analysis can be characterized as an iteration between analyzing the behavior and information of the system. Moreover, object-oriented analysis uses the object-oriented techniques introduced in the previous chapter.

正如前面所分析的,面向对象的分析和F/D分析这两种分析方法存在现状的区别。我们知道,F/D方法的设计过程是从定义系统的功能行为和数据结构开始的;而面向对象的方法倾向于把功能和数据关联在一起,并作为一个集成的整体来考虑。OO分析的特点是把系统行为和系统数据结构的分析作为一个整体来描述。此外,OO分析也应用了一些OO建模所特有的技术,比如继承,多态,封装等。

Object-oriented analysis contains, in some order, the following activities:

Finding the objects

Organizing the objects

Describing how the objects interact

Defining the operations of the objects

Defining the objects internally

面向对象的分析过程,主要包含以下的主要活动:

选找对象

组织对象的集合

描述对象之间是如何交互

定于对象所提供的操作

定义对象的内部结构

 

4.3.1   Finding the objects

The objects can be found as naturally occurring entities in the application domain. An object becomes typically a noun which exists in the domain and, because of this, it is often a good start to learn the terminology for the problem domain. By means of learning what is relevant in the application domain, the objects will be found. It is often the case that there is no problem in finding objects; the difficulty is usually in selecting those objects relevant to the system. The aim is to find the essential objects, which are to remain essential throughout the system's life cycle. As they are essential, they will probably always exist and, in this way, we hope to obtain a stable system. Stability also depends on the fact that modifications often begin from some of these items and therefore are local. For example, in an application for controlling a water tank, typical objects would include Contained Water, Regulator, Valve and Tank; for a banking application typical objects would include Customer, Account, Bank and Clerk.

   对象可以非常自然的从应用领域中存在的实体来寻找。一个对象通常是一个名词,这个名词会在应用领域中存在,正是基于这一点,对OO建模人员来说,在分析阶段开始学习问题领域的专业知识会非常有帮助。通过学习在应用领域存在那些实体,建模人员将会非常方便的找到存在的对象。根据我们实践的经验,寻找需要的对象往往比较容易,然而筛选那些和IT系统有关联的对象,则比较困难对象建模的目标是找到必要的基本对象,这些基本对象将在系统的整个生命周期中存在。因为这些对象是基本的,他们通常会在系统运行过程中一直存在,这样一来,我们希望获得一个可靠的系统。系统的可靠性也基于面向对象系统的一个特点,后续系统的很多调整会是从这些基本项目开始,而通常这种调整往往是本地的举个例子来说,在一个控制水箱的系统应用中,典型的对象将包含水,调节器,容器等;而一个银行系统中,典型的对象将包含客户,帐户,银行和职员。

 

The majority of object-oriented methods today have only one type of object. In this way, one obtains a simple and general model. Yet there are reasons for having several different object types: with only one object type, it can be quite difficult to see the difference between different objects. By having different object types, one can more quickly obtain an overview of the system. One can also obtain more support in improving the system's structure by having different rules for different objects. An example of this is that a passive object containing persistent information should not be dependent on objects which deal with the interface, as modifications in the interface are very common.

  目前主流的面向对象的方法通常只有一种类型的对象。基于这种方法,系统建模人员可以获得一种简单和通用的模型。然而,我们有理由来拥有几个不同的对象类型。在应用一种对象类型的情况下,我们非常难以发现不同对象之间的区别。而通过定义不同的对象类型,我们则可以非常方便的获得系统的全局视图。另外系统的设计者可以针对不同类型的对象定义不同的规则,这样一来就可以有效的支持提升系统的结构化能力。举个例子来说,一个用于保存信息结构的被动对象必须和负责接口功能的对象相互独立,因为接口对象在系统的生命周期中会频繁的变更。

Different object types can be organized according to different criteria. Some examples are to group them by characteristics, such as active/passive, physical/conceptual, temporary/permanent/persistent, part/whole, generic/specific, private/public, shared/ non-shared.

  不同的对象类型可以根据不同的属性来分类。我们可以根据不同的特征来进行分类,比如主动/被动,物理/逻辑,临时/永久/持久,部分/整体,通用/特定,私有/公有,共享/非共享。

 

4.3.2   Organizing the objects

There are a number of criteria to use for the classification and organization of objects and classes of objects. One classification starts by considering how similar classes of objects are to each other. This is normally the basis of inheritance hierarchy; a class can inherit another class. Another classification can be made by considering which objects work with which other objects, or how an object is a part of another; for example a house can be built of doors and windows. A similar classification is to see which objects are in some way dependent on another and thus have modification as a basis of grouping into subsystems.

  在面向对象的设计过程中, 存在一系列的准则来针对相关的对象和类进行分类和组织. 其中一个分类的准则是通过分析不同对象之间的相似性的关系入手,这种分析方法就是层次化继承关系分析设计过程的一个基础;换句话说一个类可以从其他的类中进行继承.另外一种对象之间的分类关系是分析一个对象和其他对象之间的协作关系,或者是一个对象和其他对象之间的组成关系,举个例子来说,一个房子可以有窗户和门组成. 另外一种类似的分类方法是来看一个对象是否是以一种特殊的方式依赖另外的对象,并且是否可以聚类为一个子系统.

 

4.3.3   Object interaction

      对象互操作(协作)

In order to obtain a picture of how the object fits into the system, we can describe different scenarios or use cases in which the object takes part and communicates with other objects. In this way, we can fully describe the object's surroundings and what the other objects expect from our object. The object's interface can be decided from these scenarios. We then also consider how certain objects are part of other objects.

   为了能够获得对象是如何和系统适配的一个完整视图,我们可以描述不同的场景scenarios,或者是用例scenarios下,有那些对象参与了处理的过程,并且和其他对象进行可通讯. 通过这种方法,我们可以完整的描述对象的边界和外部环境surroundings,以及有那些对象期待与之交互. 同时对象的接口可以通过这些场景进行确定scenarios. 同时我们可以据决策特点的对象和其他对象的组成关系.

 

4.3.4   Operations on objects

The object's operations come naturally when we consider an object's interface. The operations can also be identified directly from the application, when we consider what can be done with the items we model. They can be primitive (for example, create, add, delete) or more complex such as putting together some report of information from several objects. If one obtains very complex operations, new objects can be identified from them. Generally, it is better to avoid objects that are too complex.

  当我们在定义对象的接口的情况下,我们会同步考虑对象的操作. 这些操作也可以直接从应用的角度来决定,当我们在考虑我们在建模一些项目目时,可以针对这些项目做那些处理. 这些操作可能是非常原始的(举个例子来说,创建,增加,删除),或者更加复杂;比如从一些对象中获取一些信息形成一个报告.假如我们发现了一个非常复杂的操作,我们有可能从中央到地方获得新的对象,在设计中,我们要尽可能的避免过于复杂的对象.

 

4.3.5   Object implementation

Finally, the object should be defined internally, which includes defining the information that each object must hold. Even the number of instances that can be created of each object is interesting; one may wish to have alternative ways of storing information. Some of the attributes can be inherited.

  最后,每一个对象必须从内部进行定义,这种定义就包括每一个对象需要保持的内部信息结构. 另外,每一种兑现所能够创造的消息实例的数量也需要综合考虑.有些设计者希望能够拥有不同的方式来保存信息结构.另外对象的一些信息结构可以非常方便的进行继承.

To summarize the above points, we can note that all of these steps are dependent on other steps and that, during development, these steps are typically worked with iteratively. It is important in an analysis phase to concentrate on understanding the problem domain, as the result here will affect the whole of the remaining work. Experience has shown that objects identified from the application domain are very stable and, after some work has been performed, both work and documentation will revolve around these objects.

  总结上面提到的要点,我们可以发现这些步骤之间存在一种顺序依赖关系,另外在IT系统的研发过程中,这些步骤通常是密切关联的(iteratively).在分析阶段,最重要的一点是要能够关注有效的理解问题领域(problem domain),因为针对问题领域的分析将对后续的整个工作产生重大的影响. 经验显示,从领域模型中提炼的对象通常是非常可靠, 并且当我们已经完成一些分析工作以后, 需要同步围绕这些对象进行分析和文档的工作.,

We mentioned earlier that one of the advantages with object-oriented analysis is that it reduces the semantic distance between the domain and the model. This is due to the fact that object-oriented analysis bases the system structure on the human way of looking at reality, namely the objects, classification and hierarchical understanding used when people understand their surroundings. Thus the result of the object-oriented analysis is easier to understand and thus easier to maintain than the result of a function/data analysis.

前面我们已经提到了,采用面向对象的分析方法有一个巨大的优势在于能够最大限度的减少领域应用和IT模型的差距semantic distance. 这是因为在面向对象的分析过程中, 系统分析人员组织模型的方式是基于人的观点开看待现实世界,命名对象, 在充分理解应用领域的外部环境的基础上,可以进一步对对象进行分类和继承. 这样一来,面向对象的分析过程和结果就变得非常容易理解, 所以就非常利于维护相比较于传统的function/data分析结果.

Another advantage of object-oriented analysis is that items with a low modification probability are naturally identified and it is possible to isolate at an early stage items with a high probability of modification.

  另外一个面向对象分析的优点在于那些具有稳定倾向(with a low modification probability)的条目可以自然的进行标识,同时我们可以对那些具有多变倾向with a high probability of modification.的条目在设计的早期阶段进行隔离

We shall see later how OOSE contains all of the above mentioned parts, in a slightly different order. Several of the issues discussed here are treated in OOSE in different ways. We shall postpone the discussion of OOSE analysis until a later chapter.

后续我们将看到,OOSE是如何基于一个稍微不同的顺序处理上述的分析要点. 在这里讨论的一些条目在OOSE的设计中会通过不同的方法来对待. 我们将暂停这个讨论,直到下一个章节.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值