UML – Class Diagram – Dependency/Uses

We have already discussed about ‘is-a’ and ‘has-a’ relationship. If you haven’t got a chance to look at those posts please refer the below give posts.

  1. UML — Class Diagram — Generalization & Realization.
  2. UML — Class Diagram — Association.

Dependency is the third and more weaker form of relationship between two classes. If one class uses another class at some point in time that relationship is called as dependency.

How to represent dependency/uses relationship in UML?

In UML we use pointed arrow with dotted line towards the used class.
UML — Class Diagram — Dependency/Uses

Dependency/Uses relationship in java source code.

In the above code EmployeeManager uses TaxCalculator. The scope of the relationship ends when the method ends.

Another way to code uses/dependency relationship in java.