UML基本架构建模--类的通用建模技术(四)



Modeling Primitive Types

构建原始类型模型

At the other extreme, the things you model may be drawn directly from the programming language you are using to implement a solution. Typically, these abstractions involve primitive types, such as integers, characters, strings, and even enumeration types, that you might create yourself.

另一方面,你建模的事物也许直接来自为实现解决方案而使用的编程语言.最典型地的是抽象事物所包含的原始类型,如整数,字符,字符串,甚至枚举类型,你还可以创建自己的原始类型.

To model primitive types,

为原始类型建模,

1.Model the thing you are abstracting as a class or an enumeration, which is rendered using class notation with the appropriate stereotype.

将抽象的事物以某种类或是某种枚举类型建模,这是通过带有适当模板标识的类来表达这种模型.

2.If you need to specify the range of values associated with this type, use constraints.

如果你需要指定该类型关联的值的范围,使用约束.

As Figure 4-12 shows, these things can be modeled in the UML as types or enumerations, which are rendered just like classes but are explicitly marked via stereotypes. Primitive types such as integers (represented by the class Int ) are modeled as types, and you can explicitly indicate the range of values these things can take on by using a constraint; the semantics of primitive types must be defined externally to UML. Enumeration types, such as Boolean and Status , can be modeled as enumerations, with their individual literals listed within the attribute compartment (note that they are not attributes ). Enumeration types may also define operations.

如图4-12显示的,这些事物在UML中可以做为类型或是枚举型建模,它们像类一样但是通过模式化被明确标识.象整数这样的原始类型被作为类型建模,并且你可以通过在这些事物上使用约束来明确地指示出值的范围;原始类型的语义必须从外部定义到UML.枚举类型,如布尔和状态,可以作为枚举建模,在属性栏里用具体的文字列出(备注不是属性).枚举类型也能定义操作.

Note: Some languages, such as C and C++, let you set an integer value for an enumeration literal. You can model this in the UML by attaching a note to an enumeration literal as implementation guidance. Integer values are not needed for logical modeling.

备注:某些语言,如C和C++,允许你为枚举内容设置整数值.在UML中你可以通过给枚举内容附上备注作为实施向导.整数值不是逻辑建模所必震的.

时间: 2024-08-25 14:16:52

UML基本架构建模--类的通用建模技术(四)的相关文章

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

 Modeling the Vocabulary of a System 为系统的词汇表建模 You'll use classes most commonly to model abstractions that are drawn from the problem you are trying to solve or from the technology you are using to implement a solution to that problem. Each of thes

UML基本架构建模--类的通用建模技术(三)

 Modeling Nonsoftware Things 构建非软件事物模型 Sometimes, the things you model may never have an analog in software. For example, the people who send invoices and the robots that automatically package orders for shipping from a warehouse might be a part of

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

 Modeling the Distribution of Responsibilities in a System 为系统的职责分配建模 Once you start modeling more than just a handful of classes, you will want to be sure that your abstractions provide a balanced set of responsibilities. What this means is that y

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基本架构建模--通用机制的术语和概念(四)

 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 c

微服务架构下静态数据通用缓存机制

在分布式系统中,特别是最近很火的微服务架构下,有没有或者能不能总结出一个业务静态数据的通用缓存处理机制或方案,这篇文章将结合一些实际的研发经验,尝试理清其中存在的关键问题以及探寻通用的解决之道. 什么是静态数据 这里静态数据是指不经常发生变化或者变化频率比较低的数据,比如车型库.用户基本信息.车辆基本信息等,车型库这种可能每个月会更新一次,用户和车辆基本信息的变化来源于用户注册.修改,这个操作的频率相对也是比较低的. 另外这类数据的另一个特点是要求准确率和实时性都比较高,不能出现丢失.错误,以及

大气智能家居家具装修装饰类企业通用网站织梦模板【dedecms模板】

模板名称:大气智能家居家具装修装饰类企业通用网站织梦模板模板介绍:织梦最新内核开发的模板,适合智能家居家具企业,也可以通用装修行业等企业使用,页面简洁简单,容易管理,DEDE5.5内核以上都可以使用:附带测试数据! 模板特点:1:智能家居家具展示公司模板,代码简洁,风格大气简单,页面干净.2:首页带炫酷的幻灯片,产品展示,新闻展示.3:网站内容都能在后台修改,后台简单易学.4:后台直接修改联系方式.地址.版权信息,网站内容等,修改更加方便. 使用程序:织梦DEDECMS5.5以上版本都可以使用.

基于类的通用视图

基于类的通用视图 前面我们说过了django的通用视图,不知道django通用视图的去看我前面的随笔,谢谢 django的通用视图帮我们省略了很多代码,但有时候django的通用视图并不能满足我们全部的需求,例如像重定义一些属性和方法的时候,或者我们想换种写法的时候,因此,django提供了基于类的通用视图,通过子类或者在url中传参的方法来配置我们的基于类的通用视图 通用视图和基于类的通用视图是两种不一样的写法,前面我们介绍的通用视图,所有的代码集中于url的配置文件中,而基于类的通用视图主要