Applying UML and Patterns: An Introduction to ObjectOriented Analysis and Design and Iterative Development, Third Edition [Electronic resources]

Craig Larman

نسخه متنی -صفحه : 472/ 359
نمايش فراداده

32.16. Qualified Associations

A

qualifier may be used in an association; it distinguishes the set of objects at the far end of the association based on the qualifier value. An association with a qualifier is a qualified association.

For example,

ProductDescriptions may be distinguished in a

ProductCatalog by their

itemID , as illustrated in Figure 32.24 (b). As contrasted in Figure 32.24 (a) vs. (b), qualification reduces the multiplicity at the far end from the qualifier, usually down from many to one. Depicting a qualifier in a domain model communicates how, in the domain, things of one class are distinguished in relation to another class. They should not, in the domain model, be used to express design decisions about lookup keys, although that is suitable in other diagrams illustrating design decisions.

Figure 32.24. Qualified association.

Qualifiers do not usually add compelling useful new information, and we can fall into the trap of "design-think." However, used judiciously, they can sharpen understanding about the domain. The qualified associations between

ProductCatalog and

ProductDescriptions provide a reasonable example of a value-added qualifier.