Welcome to MSDN Blogs Sign in | Join | Help

Are qualified associations necessary?

When I'm creating domain models, the ability to place properties on a relationship is proving very useful.

For example, at the moment I'm remodelling our designer definition format (we generate it from a domain model) and have a relationship between Connector and Decorator and Shape and Decorator. Decorators have a position, which is modelled as an enumeration (inner-top-right, etc.), but the values of the enumeration are different depending on whether the decorator is on a Shape or on a Connector (inner-top-right is not a meaningful position for a connector). Without properties on relationships, we'd have to subclass Decorator to ShapeDecorator and ConnectorDecorator, and all we'd be adding was a differently typed Position property in each case. With properties on relationships, we can just attach a differently typed Position property to the relationships from Shape to Decoarator and from Connector to Decorator, respectively - no subclassing required.

UML has associations which are like our relationships. You can attach properties (attributes) to associations via their association classes. UML also has qualified associations, where you can index links of the associations by a property - e.g. an integer or a position. But it seems to me that one could achieve the effect of qualified associations by adding attributes to association classes, as we add properties to relationships. So, in my mind, if you've got association classes, qualified associations are redundant.

Am I missing something?

Published Monday, October 17, 2005 1:57 PM by Stuart Kent

Comments

# re: Are qualified associations necessary?

What are you saying? There's more than UML than is strictly necessary? Surely not!
Tuesday, October 18, 2005 3:44 AM by Jim

# re: Are qualified associations necessary?

Yes. If the association has a 0..1 or 1 multiplicity, the qualifier acts as a uniqueness constraint (i.e. for each Connector there can only be one Decorator for a given position value).
Tuesday, October 18, 2005 7:46 AM by Anders Ivner

# re: Are qualified associations necessary?

Are you suggesting that the constraints on valid configurations of objects/links/link-properties are identical with (a) vanilla properties on relationships and (b) qualified associations?
Monday, October 31, 2005 12:21 PM by Me

# re: Are qualified associations necessary?

Anders, I think you've identifed exactly what qualifiers add, which is the uniqueness constraint, in the case of multiplicity max = 1.
Friday, November 11, 2005 7:52 AM by Stuart Kent
New Comments to this post are disabled
 
Page view tracker