所需的接口vs接口实现vs<< use>>依赖 [英] required interface vs interface realization vs <<use>> dependency

查看:110
本文介绍了所需的接口vs接口实现vs<< use>>依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所示,这三个之间有什么区别?何时应该使用三个中的一个而不是其他两个? 互联网上充斥着它们的定义,但我找不到有关何时何地使用所需接口或<<use>>依赖项的任何文本或解释.

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.

推荐答案

实际上只有两种情况:一方面实现/使用,另一方面提供/要求.它们本质上描述的是同一件事,但重点不同.

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.

这篇关于所需的接口vs接口实现vs&lt;&lt; use&gt;&gt;依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆