UML基本架构建模--通用机制的术语和概念(三

Stereotypes

模式化

The UML provides a language for structural things, behavioral things, grouping things, and notational things. These four basic kinds of things address the overwhelming majority of the systems youll want to introduce new things that speak the vocabulary of your domain and look like primitive building blocks.

A stereotype is not the same as a parent class in a parent/child generalization relationship. Rather, you can think of a stereotype as a metatype (a type that defines other types), because each one creates the equivalent of a new class in the UML’s metamodel.For example, if you are modeling a business process, you’ll want to introduce things like workers, documents, and policies. Similarly, if you are following a development process, such as the Rational Unified Process, you’ll want to model using boundary, control, and entity classes. This is where the real value of stereotypes comes in. When you stereotype an element such as a node or a class, you are in effect extending the UML by creating a new building block just like an existing one but with its own special modeling properties (each stereotype may provide its own set of tagged values), semantics (each stereotype may provide its own constraints), and notation (each stereotype may provide its own icon).

In its simplest form, a stereotype is rendered as a name enclosed by guillemets (for example,name ) and placed above the name of another element. As a visual cue, you may define an icon for the stereotype and render that icon to the right of the name (if you are using the basic notation for the element) or use that icon as the basic symbol for the stereotyped item. All three of these approaches are illustrated in Figure 6-5.

在它的最简单的形式里,一个模式化被表现为由尖括号包含起来的一个名称(如,《名称》),被置于另一个元件名称之上.作为图形标识(如图6-5 a),你可能为模式化定义一个图标,放在那个代表元件名称的右边(如果你为这元件使用了基本的标记,如图6-5 b)或是使用那个图标作为模式化项目的基本符号(如图6-5 c).

Note:When you define an icon for a stereotype, consider using color as an accent to provide a subtle visual cue (but use color sparingly). The UML lets you use any shape for such icons, and if your implementation permits it, these icons might appear as primitive tools so that users who create UML diagrams will have a palette of things that look basic to them and speak the vocabulary of their domain.

Tagged Values

标签值

Every thing in the UML has its own set of properties: classes have names, attributes, and operations; associations have names and two or more ends, each with its own properties; and so on. With stereotypes, you can add new things to the UML; with tagged values, you can add new properties to a stereotype.

在UML中每个事物都有它自己的属性集:类有名称,属性和操作;关联有名称和两个或更多个终端,每个终端又有自己的属性等等.用模式化,你可以加新的事物到UML中;而用标签值,你可以加新的属性到一个模式化中.

You define tags that apply to individual stereotypes so that everything with that stereotype has that tagged value. A tagged value is not the same as a class attribute. Rather, you can think of a tagged value as meta-data because its value applies to the element specification, not to its instances. For example, as Figure 6-6 shows, you can specify the required capacity of a server class or require that only one kind of server be used in a given system.

你定义的标签是应用到个人的模式化中,以便每个带有模式化的事物拥有标签值.一个标签值与一个类的属性并不一样.相反,你可以把标签值想像成元数据,因为它的值是应用到元件的描述中,而不是它的实例.如图6-6显示的.你可以描述一个服务类的容量需求或仅仅是服务中的一种被使用于一个给定系统中的需求.

Tagged values are placed in a note attached to the affected element, as shown in Figure 6-7. Each tagged value comprises a string that includes a name (the tag), a separator (the symbol =), and a value(of the tag).

标签值被放在备注里,而备注是附属于它所影响的元件上.如图6-7所示.每个标签值组成一个字符串,这个字符串包含一个名称(标签),,一个分隔符(符号=)和一个值(标签的).

变幻原是永恒,我们唯有用永恒的诺言制约世事的变幻。

UML基本架构建模--通用机制的术语和概念(三

相关文章:

你感兴趣的文章:

标签云: