UML 中是否存在接口图?
Does interface diagram exist in UML?
UML 中是否存在接口图,或者它是否构成组件图的一部分,我对此感到困惑,因为我是该领域的新手。
通常接口由class图中的lollypop符号标识
组件图中的接口可以这样表示
或者这样
查看此 link 了解更多信息 https://www.ibm.com/developerworks/rational/library/dec04/bell/
TLDR
没有单独的"interface diagram"。您可以使用任何结构图,例如Class、组件等
详细解答
接口是一个独立于组件图的概念,在 UML 2.5 的第 10.4 节中进行了描述。规范。
An Interface is a kind of Classifier that represents a declaration of a set of public Features and obligations that together constitute a coherent service. An Interface specifies a contract; any instance of a Classifier that realizes the Interface shall fulfill that contract. The obligations associated with an Interface are in the form of constraints (such as pre- and
postconditions) or protocol specifications, which may impose ordering restrictions on interactions through the Interface.
可以呈现一个界面
- 在 Class 图上(通常作为带有
<<interface>>
关键字的 Class 符号,但也允许使用套接字表示法)
- 在组件图上,您可以在其中使用 Class 符号表示法或套接字表示法。
- 在复合结构图上,通常使用套接字表示法表示。
矩形符号、套接字符号和文本符号是完全可以互换的,只要允许使用一个,另一个也可以使用。此处建议的符号用法仅来自典型图表用法。
Classifier(矩形)表示法
矩形符号提供有关接口规范的详细信息。
10.4.4。说:
An Interface may be designated using the default notation for Classifier (see 9.2.4) with the keyword «interface».
和 10.4.5。进一步说明:
(...) in cases where Interfaces are represented using the rectangle notation, InterfaceRealization and Usage dependencies are denoted with appropriate dependency arrows (see Figure 10.11). The Classifier at the tail of the arrow implements the Interface at the head of the arrow or uses that Interface, respectively.
根据前述图10.11
- 用虚线箭头和空心三角形作为头部来描绘实现
- 依赖项被描述为使用依赖项(即依赖项箭头是带有开放箭头的虚线,带有 <<use>>
关键字)
套接字表示法
套接字球符号以简单的图形方式可视化接口,清楚地描述提供的和需要的接口。对于组件,它通常与端口的概念附加链接。
10.4.4。提供此说明:
Alternatively an InterfaceRealization dependency from a BehavioredClassifier to an Interface may be shown by representing the Interface by a circle or ball, often also called lollipop, labeled with the name of the Interface, attached by a solid line to the BehavioredClassifier that realizes this Interface.
The Usage dependency from a Classifier to an Interface is shown by representing the Interface by a half-circle or socket, labeled with the name of the Interface, attached by a solid line to the Classifier that requires this Interface.
(...)
If a Dependency is wired from a Usage to an InterfaceRealization that are represented using a socket and a lollipop, the dependency arrow may be shown joining the socket to the lollipop
隔间符号
作为 Classifier 隔间的文本符号是为组件定义的。由于其他 Class 分类器可以有任何隔间,类似的符号可以用于任何其他分类器。
根据 10.6.4.
A conforming tool may optionally support compartments named “provided interfaces” and “required interfaces” listing the provided and required Interfaces by name. This may be a useful option in scenarios in which a Component has a large number of provided or required Interfaces.
UML 中是否存在接口图,或者它是否构成组件图的一部分,我对此感到困惑,因为我是该领域的新手。
通常接口由class图中的lollypop符号标识
组件图中的接口可以这样表示
或者这样
查看此 link 了解更多信息 https://www.ibm.com/developerworks/rational/library/dec04/bell/
TLDR
没有单独的"interface diagram"。您可以使用任何结构图,例如Class、组件等
详细解答
接口是一个独立于组件图的概念,在 UML 2.5 的第 10.4 节中进行了描述。规范。
An Interface is a kind of Classifier that represents a declaration of a set of public Features and obligations that together constitute a coherent service. An Interface specifies a contract; any instance of a Classifier that realizes the Interface shall fulfill that contract. The obligations associated with an Interface are in the form of constraints (such as pre- and postconditions) or protocol specifications, which may impose ordering restrictions on interactions through the Interface.
可以呈现一个界面
- 在 Class 图上(通常作为带有
<<interface>>
关键字的 Class 符号,但也允许使用套接字表示法) - 在组件图上,您可以在其中使用 Class 符号表示法或套接字表示法。
- 在复合结构图上,通常使用套接字表示法表示。
矩形符号、套接字符号和文本符号是完全可以互换的,只要允许使用一个,另一个也可以使用。此处建议的符号用法仅来自典型图表用法。
Classifier(矩形)表示法
矩形符号提供有关接口规范的详细信息。
10.4.4。说:
An Interface may be designated using the default notation for Classifier (see 9.2.4) with the keyword «interface».
和 10.4.5。进一步说明:
(...) in cases where Interfaces are represented using the rectangle notation, InterfaceRealization and Usage dependencies are denoted with appropriate dependency arrows (see Figure 10.11). The Classifier at the tail of the arrow implements the Interface at the head of the arrow or uses that Interface, respectively.
根据前述图10.11
- 用虚线箭头和空心三角形作为头部来描绘实现
- 依赖项被描述为使用依赖项(即依赖项箭头是带有开放箭头的虚线,带有 <<use>>
关键字)
套接字表示法
套接字球符号以简单的图形方式可视化接口,清楚地描述提供的和需要的接口。对于组件,它通常与端口的概念附加链接。
10.4.4。提供此说明:
Alternatively an InterfaceRealization dependency from a BehavioredClassifier to an Interface may be shown by representing the Interface by a circle or ball, often also called lollipop, labeled with the name of the Interface, attached by a solid line to the BehavioredClassifier that realizes this Interface.
The Usage dependency from a Classifier to an Interface is shown by representing the Interface by a half-circle or socket, labeled with the name of the Interface, attached by a solid line to the Classifier that requires this Interface.
(...)
If a Dependency is wired from a Usage to an InterfaceRealization that are represented using a socket and a lollipop, the dependency arrow may be shown joining the socket to the lollipop
隔间符号
作为 Classifier 隔间的文本符号是为组件定义的。由于其他 Class 分类器可以有任何隔间,类似的符号可以用于任何其他分类器。
根据 10.6.4.
A conforming tool may optionally support compartments named “provided interfaces” and “required interfaces” listing the provided and required Interfaces by name. This may be a useful option in scenarios in which a Component has a large number of provided or required Interfaces.