In UML 2.0, there are two ways of representing an association between classes which I can't seem to distinguish between.
First of all, there is the qualified association, represented as such:
You also have an association class, represented as such:
I would say that in the case of a qualified association, it is assumed that class 2 holds a reference to an indexed collection of class 1 objects, so it can access a reference to an object of class 1 by its qualifier in the collection.
In the case of an association class, it is usually said that the association class is the association. I would assume in practical terms that at least one of the associated classes has a reference to the association class, which in turn has a reference to both the classes.
I'd love to hear a more educated and insightful perspective on this.
Best Answer
Both diagrams express different things:
the qualified association expresses more accurately a complex association. The qualifier has a value semantic: it is made of one or several properties that allow to select the relevant association instances.
Everything told about the qualified association is true but only if taking into account the qualifier. For example a one to one qualified association could be a one to many association without considering the qualifier.
The qualifier is only about specifying an association. It does not imply that other propertied could also belong to the the association.
the association-class expresses that an association is complex and that it could have additional properties that describes its instances. There is a reference semantic, because there are properties behind that association that belong to neither of the associated classes.
Applying this to your example:
Employee
is qualified with aperiod:dateRange
to be associated to 0..1Company
.Employee
could have had manyCompany
, so that it should be a multiplicity of*
on the side of theCompany
;period
, the qualified association would no longer fully represent your domain.For the last case, take for example
jobTitle
: it would depend onperiod
but neither belongs toEmployee
(an employee can have several job titles), nor to theCompany
(since there are many job titles in a company), nor to the qualifier (since it does not qualify/subdivide further the association):Employee
qualified withperiod
would be associated with aJobAssignement
class, which would contain all the infos that you would otherwise put in the association class. The job assignment class would be associated with the company (many to one).