正确使用关联类 [英] Correct use of an association class

查看:113
本文介绍了正确使用关联类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉UML,也不确定我的图表是否正确。我想从比我更有经验的人那里得到一些建议。

I am new to using UML and I am not sure if my diagram is correct. I would like some advice from someone more experienced than me.

我的问题的陈述是:


学生学习课程,每个学生可以参加几门课程学习。任何一门课程都可以有多个学生来学习。

Students study courses and each student can take several courses "studies" each. Any course can have more than one student studying it.

通过数字代码标识的学生具有姓名,出生日期和一个或多个国籍。
学习的学生可以获得奖学金。

Students, who are identified by a numerical code, have a name, date of birth and one or more nationalities. A student who studies can receive scholarships.

每个课程的学生可以获得多于一项的奖学金。而且,可以为多名学生提供
的个人奖学金。
奖学金有一个数字代码,用于标识他们,姓名,
基本金额以及在分配
时要满足的不同条件。

A Student can recieve more than one scholarship per course. And an individual scholarship can be given to more than one student. The scholarships have a numeric code, which identifies them, a name, a base amount and different conditions to be fulfilled at the time of the assignment.

我的建议如下:

My proposal is the following:

我想要代表学生,助学金和学生参加的课程,而且我不确定应该使用关联关系还是三元关系。

What I want is to represent students, grants and the courses the student takes, and I am not sure if I should use an associative relation or a ternary relation.

有人可以确认我的提案UML图是否正确吗?

Can anybody confirm if my proposal UML diagram is the right one?

推荐答案

唯一与学生,课程和课程直接相关的陈述。补助金是不清楚的意思,学生每门课程最多可以获得一笔补助金。

The only statement directly relating students, courses & grants is the unclear "[a s]tudent can receive more than one grant per course".

它实际上只是说每门学生课程一对可以有多个相关的补助金。 (也许作业的作者认为每个一句话的含义远不止于此,但事实并非如此。)这并不是说学生他们的补助金是否取决于他们的课程,以及如何取决于他们的课程。如果使用三元组,则您无法说出任何其他三元组,那么您的设计是最好的。带有Takes(学生,课程)的设计;如果您知道学生和学生,则最好使用接收到获取中的FK(外键){学生,课程}来接收(学生,课程,助学金)。课程对,那么您就知道其助学金。如果补助金与课程无关地给予学生,则采用Takes(学生,课程)&的设计。

It only actually says that each student-course pair can have more than one associated grant. (Maybe the author of the assignment thought that that "per" sentence is saying more than that, but it's not.) It doesn't say of a student whether their grants depend on their courses, and if so how. Your design is best when given a triplet you can't tell anything about any other triplet. The design with Takes(student,course) & Receives(student, course, grant) with th FK (foreign key) {student, course} from Receives to Takes is best when if you know a student & course pair then you know its grants. If grants are given to a student independently of courses then a design with Takes(student,course) & Receives(student,grant) is enough.

与您的老师一起澄清。

这篇关于正确使用关联类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆