类的术语和概念



Terms and Concepts

术语和概念

A classis a description of a
set of objects that share the same attributes, operations, relationships, and semantics. Graphically, a class is rendered as a rectangle.

一个类描述一组对象,这组对象共享相同的属性,操作,关系和语义.图形上,一个类被表达为一个矩形.

Names

名称

Every class must have a name that distinguishes it from other classes. Aname
is a textual string. That name alone is known as a simple name;
aqualifiednameis
the class name prefixed by the name of the package in which that class lives. A class may be drawn showing only its name, as Figure 4-2 shows.

每个类必须有一个名称以区别于其它的灯.一个名称是一个文本字符串.这个名称被称为一个简单的名称;一个合格的名称是带有这个名称所在包的前缀的名称.一个类可能只画出它的名称,就像图4-2显示的.

Note:A class name may be text consisting of any number of letters, numbers, and certain punctuation
marks (except for marks such as the double colon, which is used to separate a class name and the name of its enclosing package) and may continue over several lines. In practice, class names are short nouns or noun phrases drawn from the vocabulary of the system
you are modeling. Typically, you capitalize the first letter of every word in a class name, as in
Customer orTemperatureSentor.

备注:一个类名可以是由任意个字母,数字和某些标点符号组成(除了双冒号,它通常用来分隔类名和封装此类名的包)的文本,类名也可能超过多行.在实际中,类名通常来自你正在建模的系统的词汇表中的短名词或名词短语.通常类名的每个单词的首字母需大写,如Customer或TemperatureSentor.

Attributes

属性

Anattribute
is a named property of a class that describes a range of values that instances of the property may hold. A class may have any number of attributes or no attributes at all. An attribute represents some property of the thing you are modeling that is shared by
all objects of that class. For example, every wall has a height, width, and thickness; you might model your customers in such a way that each has a name, address, phone number, and date of birth. An attribute is therefore an abstraction of the kind of data
or state an object of the class might encompass. At a given moment, an object of a class will have specific values for every one of its class’s
attributes. Graphically, attributes are listed in a compartment just below the class name. Attributes may be drawn showing only their name, as shown in Figure 4-3.

一个属性确定一个类的特性,用来描述特性实例值的范围.一个类可能有多个属性也可能根本没有属性.一个属性表示的是你正在构建的类的所有对象共享的那些特性.例如,每面墙有高度,宽度和厚度;你也许在以这样一种方式构建你的客户模型:每个客户有一个名字,地址,电话号码和出生日期.一个属性是数据类型的抽象或是这个类的对象所包含的状态.在给定的时刻,一个类的一个对象将为它的每一个类属性设定特定的值.图形表现上,属性被列在类名称下的分隔栏内.属性可以只显示它们的名称,如图4-3显示的那样.

Note:An attribute name may be text, just like a class name. In practice, an attribute name is
a short noun or noun phrase that represents some property of its enclosing class. Typically, you capitalize the first letter of every word in an attributes name except the first letter, as inname
orloadBearing.

备注:一个属性的名称就象类名一样可以是文本.在实际中,一个属性的名称是短名词或名词短语,代表封装它的类的一些性质.通常属性名称除了第一个单词外的其它单词的首字母需大写,如name或loadBearing.

You can further specify an attribute by stating its class and possibly a default initial value, as shown Figure 4-4.

你可以通过类的状态和默认初始值来进一步说明属性,就如图4-4显示的.

Operations

操作

Anoperationis
the implementation of a service that can be requested from any object of the class to affect behavior. In other words, an operation is an abstraction of something you can do to an object that is shared by all objects of that class. A class may have any number
of operations or no operations at all. For example, in a windowing library such as the one found in Java’sawt
package, all objects of the classRectangle can
be moved, resized, or queried for their properties. Often (but not always), invoking an operation on an object changes the object’s
data or state. Graphically, operations are listed in a compartment just below the class attributes. Operations may be drawn showing only their names, as in Figure 4-5.

一个操作是一种服务,可以实现来自这个类的任何对象请求,以影响其行为.另一方面,一个操作是你对一个对象的动作被该类的所有对象所共享的抽象行为.一个类可以拥有任何数量的操作,也可以根本没有操作.举个例子,在窗口库中,如在Java
AWT包中找到的,类Rectangle的所有对象都可以被移动,可调整大小,或者查找它们的属性.通常(但不总是)在一个对象上调用一个操作改变这个对象的数据或是状态.图形表示上,操作被列在类属性下的分隔栏内.操作可以只显示它们的名称,如图4-5显示的.

Note:An operation name may be text, just like a class name. In practice, An operation name is
a short verb or verb phrase that represents some behavior of its enclosing class. Typically, you capitalize the first letter of every word in an operation name except the first letter, as inmove
orisEmpty.

备注:一个操作的名称就象类名一样可以是文本.在实际中,一个操作的名称是简单动词或动词短语,代表封装它的类的一些行为.通常操作名称除了第一个单词外的其它单词的首字母需大写,如move或isEmpty.

You can specify an operation by stating its signature, which includes the name, type, and default value of all parameters and (in the case of functions) a return type, as shown
in Figure 4-6.

你可以通过描述它标签说明一个操作,标签包括名称,类型,所有参数的默认值和(在函数的情况下)返回类型,象图4-6显示的.

类的术语和概念

时间: 2024-08-06 16:10:50

类的术语和概念的相关文章

【Java】Java Socket编程(1)基本的术语和概念

计算机程序能够相互联网,相互通讯,这使一切都成为可能,这也是当今互联网存在的基础.那么程序是如何通过网络相互通信的呢?这就是我记录这系列的笔记的原因.Java语言从一开始就是为了互联网而设计的,它为实现程序的相互通信提供了许多有用API,这类应用编程接口被称为套接字(Socket).在开始学习Java Socket之前我们需要先来了解一下基本的术语和概念. 1.计算机网络 计算机网络由一组通过通信信道(Communication channel)相互连接的机器组成.这些机器被称为:主机(host

JAVA进阶之旅(二)——认识Class类,反射的概念,Constructor,Fiald,Method,反射Main方法,数组的反射和实践

JAVA进阶之旅(二)--认识Class类,反射的概念,Constructor,Fiald,Method,反射Main方法,数组的反射和实践 我们继续聊JAVA,这次比较有意思,那就是反射了 一.认识Class类 想要反射,你就必须要了解一个类--Class,我们知道,java程序中的各个java类都属于同一事物,我们通常用Classliability描述对吧,反射这个概念从JDK1.2就出来了,历史算是比较悠久了,这个Class可不是关键字哦,这个是一个类,他代表的是一类事物: 我们归根结底就

那些年搞不懂的术语、概念:协变、逆变、不变体

简述什么是协变性.逆变性.不变性 协变性,如:string->object (子类到父类的转换) 逆变性,如:object->string (父类到子类的转换) 不变性,基于上面两种情况,不可变.具体下面再做分析. 泛型委托的可变性 先使用框架定义的泛型委托Func和Action做例子(不了解的请戳) 协变:(string->object) Func<string> func1 = () => "农码一生"; Func<object> f

C# Socket编程(1)基本的术语和概念

计算机程序能够相互联网,相互通讯,这使一切都成为可能,这也是当今互联网存在的基础.那么程序是如何通过网络相互通信的呢?这就是我记录这系列的笔记的原因.C#语言从一开始就是为了互联网而设计的,它为实现程序的相互通信提供了许多有用API,这类应用编程接口被称为套接字(Socket).在开始学习C# Socket之前我们需要先来了解一下基本的术语和概念. 阅读目录: 1.计算机网络 2.分组报文 3.协议 3.1 IP协议 3.2 TCP协议 3.2 UDP协议 4.网络地址 4.1 回环地址 5.D

类和封装的概念

类和封装的概念 什么是类? 电脑一般而言是由CPU,内存,主板,键盘和硬盘等部件组合而成. 思考:学习电脑组装需要多少时间?学习电脑组装是都需要学习显示器,键盘,鼠标,主板等部件的设计与制造? 类的封装 我们可以把程序按某种规则分成很多"块",类与类之间可能会有联系,每个类都有一个可变部分(public)和一个不可变部分(private).我们需要把可变部分和不可变部分分离出来,将不可变的部分暴露给其他类,而将可变的部分隐藏起来,以便于随时可以让它修改.这项工作就是封装. 类分为以下两

Akka学习——术语和概念

(大部分为翻译) Concurrency vs. Parallelism 并发 vs 并行 并发并不一定同时运行,比如使用时间片,使得两个任务交替执行.而并行是执两个任务真正的同时执行. Asynchronous vs. Synchronous   同步 vs 异步   如果一个方法被调用后,调用者只能等到此方法返回值或抛出异常才能继续前进,那这个方法就被称为是"同步"的. 而"异步"调用,是指调用者在经历有限的步骤之后,可以继续前进.方法的完成可以通过其它的机制进

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

我的汇编学习之路(2):主要术语和概念

对于不折不扣的汇编新手来说,第一部分中出现的很多概念可能不是很明白,于是我决定写更多有价值的文章.所以,让我们开始<我的汇编学习之路>的第二部分的学习. 术语和概念 当我写了第一篇之后,我从不同的读者那获得很多反馈,第一篇中有些部分不明白,这就是本文以及接下来几篇从一些术语的描述开始的原因. 寄存器(Register):寄存器是处理器内小容量的存储结构,处理器的主要功能是数据处理,处理器可以从内存中获得数据,但这是一种低速的操作,这就是为什么处理器为什么要有自己数据存储结构,称为"寄

【Spine】转:Spine术语和概念

一.spine术语和概念 1. Skinmesh 蒙皮 在最终的渲染结果中,蒙皮将完全显示出来,蒙皮实际上就是顶点.法线和纹理坐标等将被渲染的元素. 而其中,最关键的当然是顶点,顶点将直接被骨头牵扯运动,因而使得整个模型呈现骨骼所决定的样子. 2. Skeleton 骨骼 骨骼是一种抽象的概念,在最终的渲染结果中,它不可见.类如人体骨骼,骨骼是若干骨头(Bone)成树状的集合体,而每块骨头又分别与若干数量的蒙皮顶点关联. 当骨头运动的时候,与之关联的所有蒙皮顶点也会受骨骼的影响而运动. 骨头与蒙