Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

required interface vs interface realization vs <<use>> dependency

Tags:

interface

uml

As the title suggest what is the difference between the three and when should one use one of the three instead of the other two? The internet is filled with their definition but i couldn't find any text or explanation on when and where to use required interface or the <<use>> dependency.

like image 831
thunderbird Avatar asked Feb 24 '15 00:02

thunderbird


People also ask

What is an interface realization?

In UML diagrams, an interface realization relationship is a specialized type of implementation relationship between a classifier and a provided interface. The interface realization relationship specifies that the realizing classifier must conform to the contract that the provided interface specifies.

What are the two different ways to show dependency in class diagram?

You can use dependency relationships in class diagrams, component diagrams, deployment diagrams, and use-case diagrams to indicate that a change to the supplier might require a change to the client. You can also use a dependency relationship to represent precedence, where one model element must precede another.

What is realization explain how the interfaces are related to it?

Interface realization is a kind of specialized relation between the classifier and the interface. In interface realization relationship, realizing classifiers conforms to the contract defined by the interface.


1 Answers

There are only two cases in fact: realize/use on the one hand, and provided/required on the other. They essentially describe the same thing, but with different emphasis.

With realize/use you draw visible relationships from the class (or component, as in my examples below) to the interface, and thus show the interface and its operations in the diagram.

realize/use

You could, of course, split that into two different diagrams.

With provided/required, on the other hand, the interface is only shown as lollipops so you can't see the operations. But you can draw visible relationships (usually "assembly") between the lollipops.

provided/required

I'd say that realize/use is more appropriate if you want to show who implements what. Provided/required is more appropriate if you want to focus more on interactions between parts.

like image 164
Uffe Avatar answered Jan 01 '23 13:01

Uffe