Wednesday, July 09, 2008

UML - Relationship

  1. Is an abstract concept to interconnect elements (Class, Usecase, Package etc.).
  2. Will have a reading direction and an association name to define the reason for the relation. (Ex: -> and contains,has a etc.)
  3. Can have a role name at either end of the relationship. (Ex: attribute used by the relationship).

Types of Relationship:

At a highlevel a relationship in UML is three kinds,

  1. Association
  2. Dependency
  3. Generalization

1. Association: An association is a structural relationship where object of one classifier can connect to other and can navigate. Association is inturn classfied into,

  • Aggregation(Shared): Aggregation relationship is a strong type of association were one of the classfier acts as a whole and other a part. The aggregation is also called as shared, as part object can be detached from the whole and can be associate to a different whole object.
  • Composition(Composite): Aggregation relationship is a very strong type of association were one of the classfier acts as a whole and other a part. The life time or the existence of the part is depedent on life of the whole classifier. Part objects cannot be shared as in the aggregation.

In UML metamodel there is not metamodel element for aggregation or composition, only association with association type as none (just association), shared(Aggregation) and composite (Composition).

2. Dependency: A dependency relationship is a slightly loose relationship between source and target classifiers. Dependency is classified into,

  • Abstraction (In-turn sub divided as Realization and substitution)
  • Usage (Uses)
  • Permission (permit to access a classifier)

3. Generalization: Is a parent-child relationship where child gets the properties of the parent classifier.

No comments: