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]
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 / Keyword | Relationship | Meaning |
---|---|---|
«call» | Usage | The client calls a method of the supplier |
«create» | Usage | The client creates instances of the supplier |
«derive» | Abstraction | The client is derived from the suplier |
«instantiate» | Usage | The client gets instantiated from the supplier. If the client is a class, the supplier is a metaclass |
«permit» | Permission | The client has the permission to access the private members of the supplier |
«realize» | Realization | The client realizes the supplier, e.g. if the supplier is an interface or an abstract element. |
«refine» | Abstraction | The client refines the semantic level of the supplier |
«substitute» | Substitution | The client can be substituted with the supplier, e.g. if they share the same type |
«trace» | Abstraction | Semantical requirements are traceable from the client to the supplier |
«use» | Usage | The client requires the supplier for its implementation |
Example
class Button {
click () {
const me = this;
me.observers.map(observer => observer.notify("click", me));
}
}