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, windows, cabinets, and lights are some of the things that will be important to you as a home owner. Each of these things can be distinguished from the other.

系统建模包括识别从你特定视点来看的重要事物.这些事物形成你正在建模的系统的词汇.例如,如果你正在建一栋房子,像墙,门,窗,陈列室和灯这些事物将对你作为一个家的拥有者是很重要的.这些事物的每一个都与其它的相区别.

 

Each of them also has a set of properties. Walls have a height and a width and are solid. Doors also have a height and a width and are solid as well, but have the additional behavior that allows them to open in one direction. Windows are similar to doors in that both are openings that pass through walls, but windows and doors have slightly different properties. Windows are usually (but not always) designed so that you can look out of them instead of pass through them.

它们中的每一个也都有一些属性.墙有高,宽,并且是实心的.门也有高,宽,同样是实心的,但它有额外的行为,那就是允许向一个方向打开.窗户与门相似,都是穿过墙壁开口,但是窗户与门又有轻微的不同属性.窗户通常(但不总是)设计成你可以朝外看,但不能穿过它们.

 

Individual walls, doors, and windows rarely exist in isolation, so you must also consider how specific instances of these things fit together. The things you identify and the relationships you choose to establish among them will be affected by how you expect to use the various rooms, and the general style and feel you want this arrangement to create.

单个的墙,门和窗很少独立的存在,所以你还需要考虑如何描述这些事物合在一起的实例.你想如何使用各种房间,总体风格和你想要这样安排以利于创造的感觉,将会影响到你所识别的事物和选择的在它们之间建立的关系.

 

Users will be concerned about different things. For example, the plumbers who help build your house will be interested in things like drains, traps, and vents. You, as a home owner, wont necessarily care about these things except insofar as they interact with the things in your view, such as where a drain might be placed in a floor or where a vent might intersect with the roof line.

用户们会关心不同的事物.例如,那些帮助你建房子的水暖工对排水管,存水管,通风孔更感兴趣.而你,作为房子的拥有者,并不需要关心这一类的事物,除非他们的工作内容影响到了你,比如排水管可以放到地板下或是通风孔可能与屋顶线相交.

 

In the UML, all of these things are modeled as classes. A class is an abstraction of the things that are a part of your vocabulary. A class is not an individual object, but rather represents a whole set of objects. Thus, you may conceptually think of wall as a class of objects with certain common properties, such as height, length, thickness, load-bearing or not, and so on. You may also think of individual instances of wall, such asthe wall in the southwest corner of my study.

在UML里,这些事物都被模型化为类.一个类是你的词汇表中部分事物的抽象概念.一个类不是单个的对象,而是表现着对象的整个集合.因此,你可能在想做为一个对象的类要有通用的属性,如高度,长度,厚度,承不承重,诸如此类.你可能也在想墙的单个实例,如在西南方向的那面墙是我的学习角.

 

In software, many programming languages directly support the concept of a class. Thats excellent, because it means that the abstractions you create can often be mapped directly to a programming language, even if these are abstractions of nonsoftware things, such ascustomer,trade, or conversation.

软件里,许多程序设计语言直接支持类的概念.那非常好,因为这意味着你创建的抽象概念往往可以直接映射到程序设计语言,甚至是一些非软件方面的抽象概念,如客户贸易,或是会话

 

The UML provides a graphical representation of class, as well, as Figure 4-1 shows. This notation permits you to visualize an abstraction spart from any specific programming language and in a way that lets you emphasize the most important parts of an abstraction: its name, attributes, and operations.

UML还提供类的图形表达方式,如图4-1所示.这个标识允许你从任何具体的程序设计语言可视化抽象部分,在某种程度上,让你强调抽象概念的最重要部分:它的名称,属性和操作.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章