码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-03-06 09:41:44      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:



Constraints

约束

 

Everything in the UML has its own semantics. Generalization (usually, if you know whats 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 UMLs 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 elements 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版式                            指定该分类器是一种版式,它可以被应用到其它的元素中.

 

Youll use this stereotype when you want to explicitly model the stereotypes youve 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.

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

 

 

 

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

标签:

原文地址:http://blog.csdn.net/listen_snow/article/details/44077475

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!