UML 组件图中的接口 [英] Interfaces in UML component diagram

查看:49
本文介绍了UML 组件图中的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 UML 类图中,接口相当于编程语言中的接口概念(实现接口的类应该实现的一组方法).我想知道组件图中的接口是否有相同的含义.组件图中提到的接口是否与类图中详述的接口相同,还是应该将组件图中的每个方法都视为一个单独的接口?

In the UML class diagram the interface is equivalent to the interface concept in programming languages (a set of methods that the class that implement the interface should implement). I want to know if the interface in the component diagram has the same meaning. Are the interfaces mentioned in the component diagram the same interfaces that are detailed in the class diagram or should I treat every method in the component diagram as a separate interface?

推荐答案

实际上两者之间没有真正的区别.您可以使用类和组件来实现接口.您还可以使用套接字/棒棒糖表示法在这两种情况下显示实现.

There is actually no real difference between both. You can realize an interface with a class as well as with a component. Also you can show the realization in both cases with the socket/lollipop notation.

组件与类没有太大区别.您可以将组件视为承载许多不同类的容器.如果这些类中的一个实现了一个接口,您可以通过组件公开它(如果您愿意).此外,一个组件可以有许多用于其托管类的内部接口.

Components are not much different to classes. You can think of a component as a container that hosts a number of different classes. And if one of those classes realizes an interface you can expose that through the component (if you so wish). Additionally a component can have a lot of internal interfaces for its hosted classes.

这篇关于UML 组件图中的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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