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所示.這個標識允許你從任何具體的程序設計語言可視化抽象部分,在某種程度上,讓你強調抽象概念的最重要部分:它的名稱,屬性和操作.

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