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.
相关问题
- System sequence diagram - Can system request input
- Does Visual Studio 2010 Professional support UML m
- How to map interface names to different method nam
- Can a [GoF]-ConcreteSubject override the notify me
- How to represent enumeration classes with methods
相关文章
- List可以存储接口类型的数据吗?
- When to use Interfaces in PHP
- Can Eclipse auto-generate an interface of a 3rd pa
- Implementing interfaces in partial classes
- Code Iris plugin on Android Studio
- What is the benefit of using '--strictFunction
- In Delphi, how can you check if an IInterface refe
- internal member in an interface
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.
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.
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.
A required interface is usually shown as socket. It means that in order to have the class working it needs at runtime a counterpart with a lollipop. This counterpart in turn offers the interface via a lollipop. To decouple class and interface definition you put the interface in a stereotyped class and draw a realization from the providing class to the interface. Vice versa you draw a dependency from the requiring class to the interface. Whether you stereotype the dependency with
<<use>>
is more a matter of taste.as described above and as alternate representation: