首页 > 代码库 > UML基本架构建模--关联的通用建模技术(一)

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 toCourse , becauseCourse is used in both theaddand removeoperations ofCourseSchedule .例如,在图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 fromIteratorshows that theIteratoruses theCourseSchedule ; theCourseSchedule knows nothing about theIterator. The dependency is marked with the stereotype <permit>, which is similar to the friendstatement in C++.

这个图还显示了另一个依赖,类的操作没有涉及这个依赖,这是C++建模的常用习惯.这个依赖来自迭代器,表述的是迭代器使用课程表课程表迭代器一无所知.这个依赖被模式化<许可>所标记,这类似于C++里的友元声明.

 

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