0

An example of an association class is given here:

http://pic.dhe.ibm.com/infocenter/rsarthlp/v9/index.jsp?topic=%2Fcom.ibm.xtools.modeler.doc%2Ftopics%2Fcassnclss.html

Composition and Aggregation are also types of Associations, just with more defined semantics to what the association consists of.

Can association classes also be part of a relationship by Composition or Aggregation? That is, in the case where there is a many-to-many relationship between two entities, with some additional attributes on the relationship. Or would it be more correct to model that as two separate one-to-many relationships onto a middle entity that hold the additional attributes?

-1

The UML concept of an "association class" is questionable (in terms of its semantics and usability) and I'd recommend not using it, but always explicitly express the class representing the association, connecting it to the participating object classes with many-to-one associations.

The questionable usability of the "association class" concept is illustrated by the flawed IBM example Student-Enrollment-Course referenced in your question. In this example, contrary to what is stated, Enrollment cannot be an "association class" if Course represents the general concept of a course offering (without semester information), because an "association class" admits of only one link between the same participant objects (a student and a course), while the domain semantics requires that a student can repeatedly take a course, implying more than one enrollment link between the same student and the same course.

  • In that case the objects need to be broken out even further: a student can take the same course multiple times, but not at once. There needs to be a ScheduledCourse between Enrollment and Course which represents one occurrence of the course. – user22815 Aug 5 '14 at 15:48
  • True, but my point was that in the IBM example Course was described to contain semester information, so it had the meaning of your ScheduledCourse. – gwag Aug 5 '14 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.