Skip to main content

Dependency (UML)

A Dependency between a client (dependent) and a supplier (dependee) can be illustrated with a dashed line with its tail starting at the client and an open arrowhead ending at the supplier.

The notation is used to depict a Dependency between a client and a supplier: If the supplier changes, the client may have to change, too.

"A dependency indicates that an element on one end of the relationship, in some manner, depends on the element on the other end of the relationship." [šŸ“–OOA, p. 111]

Figure 1 The UML-notation for a Dependency. The stereotype indicates that Client requires Supplier for its implementation.

Dependency Relationship Keywordsā€‹

While there are notations available with UML that can be used for other semantics and specifications, or that already imply a dependency (such as Associations, Aggregation or Composition ), the context of a basic Dependency can further be specified with one of the following keywords ([šŸ“–UML, p. 48] and [šŸ“–ADU, p. 288]):

Stereotype / KeywordRelationshipMeaning
Ā«callĀ»UsageThe client calls a method of the supplier
Ā«createĀ»UsageThe client creates instances of the supplier
Ā«deriveĀ»AbstractionThe client is derived from the suplier
Ā«instantiateĀ»UsageThe client gets instantiated from the supplier. If the client is a class, the supplier is a metaclass
Ā«permitĀ»PermissionThe client has the permission to access the private members of the supplier
Ā«realizeĀ»RealizationThe client realizes the supplier, e.g. if the supplier is an interface or an abstract element.
Ā«refineĀ»AbstractionThe client refines the semantic level of the supplier
Ā«substituteĀ»SubstitutionThe client can be substituted with the supplier, e.g. if they share the same type
Ā«traceĀ»AbstractionSemantical requirements are traceable from the client to the supplier
Ā«useĀ»UsageThe client requires the supplier for its implementation

Exampleā€‹

Figure 2 A Usage-Dependency: Button (client) calls a method of Observer (supplier). If Observer changes, Button has to change, too.
The source code may look like this (JavaScript):
    class Button {

click () {
const me = this;

me.observers.map(observer => observer.notify("click", me));
}

}