Previous UML Classes Table of Contents UML Packages Next

7.3.50 Substitution




    Realization (from Dependencies ) on page 131


   A substitution is a relationship between two classifiers which signifies that the substitutingClassifier complies with the contract specified by the contract classifier. This implies that instances of the substitutingClassifier are runtime substitutable where instances of the contract classifier are expected.





   No additional constraints


   The substitution relationship denotes runtime substitutability that is not based on specialization. Substitution , unlike specialization, does not imply inheritance of structure, but only compliance of publicly available contracts. A substitution like relationship is instrumental to specify runtime substitutability for domains that do not support specialization such as certain component technologies. It requires that (1) interfaces implemented by the contract classifier are also implemented by the substituting classifier, or else the substituting classifier implements a more specialized interface type. And, (2) the any port owned by the contract classifier has a matching port (see ports) owned by the substituting classifier.


   A Substitution dependency is shown as a dependency with the keyword «substitute» attached to it.


   In the example below, a generic Window class is substituted in a particular environment by the Resizable Window class.




   Figure 7.74 - An example of a substitute dependency