View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Spring2004 Midterm Review: Class Diagram

This is the way I would do it as well, but it doesn't quite match the question. The question specifically calls for a Transcript class. In such a case on the exam should we follow the question even if it means we have a basically empty class (in this case a class which contains only a collection) or should we diagram it the way we think it should be?

That image looks very wrong to me. The composition between the Student and a Transcript is not complex, it's simple. When a student dies, the transcript doesn't die with it. Student has a Transcript class which is separate from himself. That TranscriptEntries thing is completely wrong. It should be a transcript, that is composed of many Sections of a class. You also have section/class backwards. Sections are composed of Classes. In this model, a class is meaningless without a section that goes with it.

Actually this is correct according to the notation in the book.

The diamond indicates that the student has a collection of multiple transcript entries an has a local instance var "transcriptEntries" that contains 0 or more "TranscriptEntry" objects.

Each transcript entry is associated with a section (under the instance var "section" that is contained in the TranscriptEntry object) and each section could be associated with 0 or more TranscriptEntry objects (because multiple students could have an entry for the same section) but a TranscriptEntry could be associated with only one Section object. That's why there's no diamond because it doesn't mean composition/aggregation, it means an association.

Additionally, it would be incorrect to have a Transcript be composed of multiple sections of a class. A section can exist independently of being included in a transcript. That is why it was necessary to include a TranscriptEntry class that is associated with a section but houses a grade for the Student. If a Transcript was composed of multiple sections, how would you store the grade for the student? You couldn't add a "grade" variable to section because then a section could only have one grade for all students. In order to make this many-to-many relationship, there must be a relator class to house the grade.

I did take some license in removing the Transcript object and that assumption is probably not correct according to the problem but it seemed redundant to me. A student that has died is simply an attribute of the student, it does not necessarily mean that the student has been removed from the system. I agree it would probably be better to have a Transcript object that is one-to-one with a Student and have nothing in it except for a collection of TranscriptEntry objects.

Which side the name went on was confusing to me as well but again, this is how the book had it so I followed suit. Could we get a ruling from the professor/TA?

The name goes closest to the entity being named, so the diagram below is correct. Rich LeBlanc

Ok, I checked the book again and my notation is correct. Although here's an updated diagram that includes the Transcript class for completeness. I've still marked the relationship between Transcript and Student to be one-to-one because just seems alien to me to have a Transcript that is not associated with a Student but in order to support your proposition that if a Student dies it goes away, then the multiplier on the Transcript side should be 0..1 instead of 1