nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Conceptual Class Diagram Help #1018

Open RunjiaChen opened 5 months ago

RunjiaChen commented 5 months ago

image In the lecture recording, it was mentioned that the 2nd CCD is more "natural" and thus a better pick to answer the question. I am confused by the prof's explanation, as during the tutorial, the same CCD is mentioned as a negative example. There could be instances where Tom exist as a coordinator for one course and an instructor for the other course. When this happens, you would need 2 instances of Tom in the CCD, which is not ideal. May I know which the better CCD and what is the rationale behind it? Thank you!

bryanyee33 commented 5 months ago

For the 2nd CCD, I think you are misunderstanding the diagram, as it is not necessary to have 2 instances of the instructor. The InstructorRole and CoordinatorRole are classes, and new objects of these roles are created whenever there is a new instructor/coordinator added to a course. The person object is simply associated with these role objects, and the same person object is used if the person has multiple roles. An example of this can be seen on the bottom right (the one with no black background).

I believe this provides more flexibility as it allows for specific fields added to each role. An example is the isPastCoord in the 2nd diagram, and more can be added to either role classes if required.

I don't think one is "better" than the other, and either one can be used depending on whether you would like to model it focusing more on simplicity or flexibility.

damithc commented 5 months ago

during the tutorial, the same CCD is mentioned as a negative example

@RunjiaChen That wasn't the same diagram. Here's the tutorial diagram, for comparison.

image

Good answer @bryanyee33