UML基本架构建模--关联的术语和概念(一).doc_第1页
UML基本架构建模--关联的术语和概念(一).doc_第2页
UML基本架构建模--关联的术语和概念(一).doc_第3页
UML基本架构建模--关联的术语和概念(一).doc_第4页
UML基本架构建模--关联的术语和概念(一).doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

A relationship is a connection among things. In object-oriented modeling, the three most important relationships are dependencies, generalizations, and associations. Graphically, a relationship is rendered as a path, with different kinds of lines used to distinguish the kinds of relationships.关联是事物之间的联系在面向对象建模中,三个最重要的关联依次是依赖,泛化和联合图形表现上,关联被显示为一条路径,使用不同的线条来区分关联的类别Dependencies 依赖A dependency is a relationship that states that one thing ( for example, class Window ) uses the information and services of another thing ( for example, class Event ), but not necessarily the reverse. Graphically, a dependency is rendered as a dashed directed line, directed to the thing being depended on. Choose dependencies when you want to show one thing using another.依赖关联表明一个事物(如窗口类)使用另一个事物(如事件类)的信息和服务,反之则不然图形表现上,依赖呈现为一条虚线指示线,箭头所指为被依赖的事物在你想显示一个事物使用另一个事物的时候选择依赖关联Most often, you will use dependencies between classes to show that one class uses operations from another class or it uses variables or arguments typed by the other class; see Figure 5-2. This is very much a using relationship - if the used class changes, the operation of the other class may be affected as well, because the used class may now present a different interface or behavior. In the UML you can also create dependencies among many other things, especially notes and packages.大多数情况下,你将使用类之间的依赖显示一个类使用来自另一个类的操作或是它使用的变量或是其它类的类型参数;如图5-2显示这是非常有用的关联如果被使用的类改变,可能会影响到其它类的操作,因为被使用的类现在呈现出的是不同的接口或行为在UML中,你还可以创建其它许多事物间的依赖关系,尤其是备注和包Note: A dependency can have a name, although names are rarely needed unless you have a model with many dependencies and you need to refer to or distinguish among dependencies. More commonly, youll use stereotypes to distinguish different flavors of dependencies.备注:依赖可以有名称,尽管很少关联需要名称,除非你有一个模型有很多的依赖,而你需要指出或是区分它们更多的时候,你使用模式化来区分不同的依赖关联的特点Generalizations泛化A generalization is a relationship between a general kind of thing ( called the superclass or parent ) and a more specific kind of thing ( called the subclass or child ). Generalization is sometimes called an “is-a-kind-of” relationship: one thing ( like the class BayWindow ) is-a-kind-of a more general thing (for example, the class Window ). An objects of the child class may be used for a variable or parameter typed by the parent, but not the reverse. In other words, generalization means that the child is substitutable for a declaration of the parent. A child inherits the properties of its parents, especially their attributes and operations. Often-but not always-the child has attributes and operations in addition to those found in its parents. An implementation of an operation in a child overrides an implementation of the same operation of the parent; this is known as polymorphism. To be the same, two operations must have the same signature ( same name and parameters ). Graphically, generalization is rendered as a solid directed line with a large unfilled triangular arrowhead, pointing to the parent, as shown in Figure 5-3. Use generalizations when you want to show parent/child relationships.泛化是一种普遍的事物(被称为超类或是父节点)和一个更具体的事物(被称为子类或是子节点)之间的关系泛化有时候被称为”从属”关系:一个事物(如中断窗口类)从属于更普遍的事物(如窗口类)一个子类的对象可能使用来自父类的变量或参数类型,但是父类不能使用子类的变量或参数类型换句话说,泛化的含义是子类替代了父类的声明一个子类继承它父类的特性,尤其是它们的属性和操作通常但不总是子类拥有除在父类中已存在之外的属性和操作在子类中某个操作的实现会覆盖父类中同样的操作实现;这被称之为多态性为了保持一致,两个操作必须有同样的标识(同样的名称和参数)图形表现上,泛化呈现为一条实线指示线,空心三角形箭头指向父类,如图5-3显示的在你想显示父子关系时使用泛化关联A class may have zero, one, or more parents. A class that has no parents and one or more children is called a root class or a base class. A class that has no children is called a leaf class. A class that has exactly one parent is said to use single inheritance; a class with more than one parent is said to use multiple inheritance.一个类可能没有,也可能有一个或多个父类一个没有父类并且有一个或多个子类的类被称为根类或基类没有子类的类被称为叶类只有一个父类的类被称为使用单一继承有多个父类的类被称为使用多重继承Most often, you will use generalizations among classes and interfaces to show inheritance relationships. In the UML, you can also create generalizations among other kinds of classifiers, such as nodes.大多数情况下,你将会使用泛化来显示类之间的继承关系在UML中,你还可以创建其它事物之间的泛化,如节点Note: A generalization with a name indicates a decomposition of the subclasses of a superclass on a particular aspect, called a generalization set. Multiple generalization sets are orthogonal; the superclass is intended to be specialized using

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论