UML基本架構建模--關聯的通用建模技術(一)


 

Modeling Simple Dependencies

建模簡單的依賴

 

A common kind of dependency relationship is the connection between a class that uses another class as a parameter to an operation.

To model this using relationship,

lCreate a dependency pointing from the class with the operation to the class used as a parameter in the operation.

普通的依賴關係是一個類與另一個被它作爲自身參數的類之間的連接.

建模這個使用的關係,

l創建一個依賴,從帶有操作的類指向在操作中被作爲參數的類.

 

For example, Figure 5-9 shows a set of classes drawn from a system that manages the assignment of students and instructors to courses in a university. This figure shows a dependency from CourseSchedule to Course , because Course is used in both the add and remove operations of CourseSchedule  .例如,在圖5-9中顯示的一組類,它們來自在大學裏分配學生和老師課程的管理系統.這個圖顯示出一個從課程表課程的依賴,因爲課程課程表中的新增移除兩個操作中都被使用到.

 

If you provide the full signature of the operation as in this figure, you dont normally need to show the dependency as well, because the use of the class is already explicit in the signature. However, youll want to show this dependency sometimes, especially if youve elided operation signatures or if your model shows other relationships to the used class.

如果你在這個圖中規定了此操作的所有特徵,通常不需要顯示這個依賴,因爲類的使用特徵已經很清晰.然而,你有時會想顯示這個依賴,尤其是如果你已經刪除了操作的特徵或是如果你的模型顯示其它關係所使用的類.

.

This figure shows one other dependency, this one not involving classes in operations but rather modeling a common C++ idiom. The dependency from Iterator shows that the Iterator uses the CourseSchedule ; the CourseSchedule knows nothing about the Iterator . The dependency is marked with the stereotype <permit>, which is similar to the friend statement in C++.

這個圖還顯示了另一個依賴,類的操作沒有涉及這個依賴,這是C++建模的常用習慣.這個依賴來自迭代器,表述的是迭代器使用課程表課程表迭代器一無所知.這個依賴被模式化<許可>所標記,這類似於C++裏的友元聲明.

 

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