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



Constraints

约束

Everything in the UML has its own semantics. Generalization (usually, if you know what’s
good for you) implies the LisKov substitution principle, and multiple associations connected to one class denote distinct relationships. With constraints, you can add new semantics or extend existing rules. A constraint specifies conditions that a run-time
configuration must satisfy to conform to the model. For example, as Figure 6-8 shows, you might want to specify that, across a given association, communication is secure; a configuration that violates this constraint is inconsistent with the model. Similarly,
you might want to specify that among a set of associations connected to a given class, a particular instance may have links of only one association in the set.

在UML中的每个事物都有它自己的语义.泛化(通常,如果你知道什么对你是好的)意味着里氏代换原则和多个关联连到一个类指示出不同的关系.用约束你可以增加新的语义或是扩展已存在的规则.约束所描述的条件是必须满足符合模型运行时的配置.举个例子,如图6-8所显示的,你也许想说明:在一个给定的关联中通信是安全的;一个配置违反了约束与模型的一致性.同样地,你也许想说明在一组连接到一个给定类的关系中,一个特定的实例是可能只有一个与组中的关联相联系.

Note:Constraints
may be written as free-form text. If you want to specify your semantics more precisely, you can use the UML’s
Object Constraint Language (OCL), described further in The Unified Modeling Language Reference Manual.

备注:约束是一种自由形式的文本.如果你想更严格地说明你的语义,可能使用UML的对象约束语言,在统一建模语言参考手册中有更进一步的描述.

A constraint is rendered as a string enclosed by brackets and placed near the associated element. This notation is also used as an adornment to the basic notation of an element to visualize
parts of an element’s specification that have no graphical cue. For example, some properties of associations
(order and changeability) are rendered using constraint notation.

 约束被表现为由一对大括号框起来的一个字符串,并被放置在相关的元件附近.这个标志也被作为修饰一个元素的基本符号,显示一个元素的说明书中没有图形表示的那部分.举个例子,一些关联的属性(顺序和可变性)使用约束标志来表现.

Standard Elements

标准元件

The UML defines a number of standard stereotypes for classifiers, components, relationships, and other modeling elements. There is one standard stereotype, mainly of interest to tool builders,
that lets you model stereotypes themselves.

UML已为分类器,组件,关系和其它模型元素定义许多标准模式.这有一个标准模式,主要是工具建造者感兴趣,允许你为模式化自己建模.

lStereotype                Specifies
that the classifier is a stereotype that may be applied to other elements.

l版式        
                   指定该分类器是一种版式,它可以被应用到其它的元素中.

You’ll use this stereotype when you want
to explicitly model the stereotypes you’ve defined for your project.

当你想为你的项目明确的建模你已定义的模式时,就可以使用这个版式.

Profiles

摘要

Often it is useful to define a version of UML tailored to a particular purpose or domain area. For example, if you want to use a UML model for code generation in a particular language, it
is helpful to define stereotypes that can be applied to elements to give hints to the code generator (like an Ada pragma). The stereotypes you define would be different for Java and C++, however. As another example, you might want to use UML for modeling databases.
Some of the UML capabilities, such as dynamic modeling, are less important, but you want to add concepts such as candidate keys and indexes. You can tailor UML using profiles.

因为一个特定的目的或是领域范围而调整UML,为这个调整过的UML定义一个版本是非常有用的.举个例子,如果你想使用UML模型的代码生成一个特定的语言,定义版式是很有帮助的,它可以被应用于元素提示代码生成器(象Ada程序).你定义的这个版式对Java和C++是不同的.然而,做为另一个例子,你可能想使用UML为数据库建模.UML的一些功能,如动态建模,虽然不重要,但你会想加点如候选键和索引这样的概念.你可以使用摘要来调整UML.

A profile
is a UML model with a set of predefined stereotypes, tagged values, constraints, and base classes. It also selects a subset of the UML element kinds for use so that a modeler is not confused
by element kinds that are not needed for the particular application area. A profile defines, in effect, a specialized version of UML for a particular area. Because it is built on ordinary UML elements, it does not represent a new language, and it can be supported
by ordinary UML tools.

摘要是一个带有一组预定义版式﹑标签值﹑约束和基本类的UML模型.它也选择了UML元素类型的一个子集使用,以便建模者不会对在特定应用领域中不需要的元素类型感到困惑.实际上一个摘要的定义是UML在特定领域内的专门的版本.由于它是建立在普通的UML元素之上,并不表现成新的语言,并且也能被普通UML工具支持.

Most modelers will not construct their own profiles. Most profiles will be constructed by tool builders, framework builders, and similar designers of generic capabilities. Many modelers will
use profiles, however. It is the same as traditional subroutine libraries ----a few experts built them but many programmers used them. We expect profiles to be constructed for programming languages and databases, for different implementation platforms, for
different modeling tools, and for various business domain application areas.

大多数的建模者不会建立自己的摘要.大多数的摘要将由工具制造者﹑框架建设者和类似通用功能的设计者建立.然而许多建模者会使用摘要.这和传统的子程序库一样--少数专家建立它们,但许多的程序员使用它们.我们期望为程序语言,为不同的实施平台,为不同的建模工具,为各种不同的商业应用领域建立摘要.

时间: 2024-08-24 01:30:14

UML基本架构建模--通用机制的术语和概念(四)的相关文章

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

 Terms and Concepts 术语和概念 A note is a graphical symbol for rendering constraints or comments attached to an element or a collection of elements. Graphically, a note is rendered as a rectangle with a dog-eared corner, together with a textual or grap

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 you'll need to model. However, sometime

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

 Notes 备注 A note that renders a comment has no semantic impact, meaning that its contents do not alter the meaning of the model to which it is attached. This is why notes are used to specify things like requirements, observations, reviews, and expl

UML基本架构建模--获取类

 Getting Started 开始 Modeling a system involves identifying the things that are important to your particular view. These things form the vocabulary of the system you are modeling. For example, if you are building a house, things like walls, doors, w

UML基本架构建模--类的辅助信息

 Organizing Attributes and Operations 组织属性和操作 When drawing a class, you don't have to show every attribute and every operation at once. In fact, in most cases, you can't (there are too many of them to put in one figure) and you probably should not

UML基本架构建模--通用机制概述

 Common Mechanisms 通用机制 The UML is made simpler by the presence of four common mechanisms that apply throughout the language: specifications, adornments, common divisions, and extensibility mechanisms. This chapter explains the use of two of these

UML基本架构建模--获得通用机制

 Sometimes you just have to color outside the lines. For example, at a job site, an architect might scribble a few notes on the building's blueprints to communicate a subtle detail to the construction workers. In a recording studio, a composer migh

UML基本架构建模--通用机制的通用建模技术(一)

 Modeling Comments 注释建模 The most common purpose for which you'll use notes is to write down free-form observations, reviews, or explanations. By putting these comments directly in your models, your models can become a common repository for all the

UML基本架构建模--通用机制的通用建模技术(二)

 Modeling New Properties 新特性建模 The basic properties of the UML's building blocks-----attributes and operations for classes, the contents of packages, and so on----are generic enough to address most of the things you'll want to model. However, if yo