Dependencies (OOM)

A dependency is a semantic relationship between two objects, in which a change to one object (the influent object) may affect the semantics of the other object (the dependent object).

A dependency can be created in the following diagrams:

The dependency relationship indicates that one object in a diagram uses the services or facilities of another object. You can also define dependencies between a package and a modeling element.

Dependencies in a Class or Composite Structure Diagram

In a class diagram, you can create a dependency between:

  • A class and an interface (and vice versa)

  • Two classes

  • Two interfaces

For example:



Dependencies in an Object Diagram

In an object diagram, you can create a dependency between two objects as follows:



Dependencies in a Use Case Diagram

In a use case diagram, you can create a dependency between:

  • An actor and a use case (and vice versa)

  • Two actors

  • Two use cases

Buying a computer from a web site involves the activity of finding the product page within the seller's web site:



Dependencies in a Component Diagram

In a component diagram, you can create a dependency between two components as shown below. You cannot create a dependency between a component and an interface.



When using a dependency, you can nest two components by using a stereotype.

Dependencies in a Deployment Diagram

In a deployment diagram, a dependency can be created between nodes, and component instances as follows: