Substitution relationships

In UML diagrams, a substitution relationship is a type of dependency between classifiers that indicates that one classifier can substitute another at run time.

The concept of a substitution dependency first appeared in the UML 2.0 specifications. A substitution is a type realization, which means that a substitution is another way in which a classifier can be implemented. In a substitution dependency, the client takes the place of the supplier class.

A substitution dependency can be especially useful for customizing models. For example, you could customize a retail system that was designed to sell product lines of sporting goods to sell music and videos. You can substitute one set of products for another while the rest of the system design remains the same.

For the substitution to occur, the substituting classifier must satisfy the contract that the other classifier specifies.

As the following figure illustrates, a substitution relationship is displayed in the diagram editor as a dashed line with an open arrow that points from the implementing classifier to the classifier that specifies the contract. The keyword «substitution» is attached to the connector.

A class named Sporting Goods Line that implements a Retail System class is substituted by a Music and Video Line class.


Feedback