加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 在UML复合结构图中定义“端口”的概念

发布时间:2020-12-14 05:49:33 所属栏目:Java 来源:网络整理
导读:在UML复合结构图中:什么是“端口”?我会如何实现一个,比如说 Java? 解决方法 我会提出,在像Java这样的OO语言中,复合结构图所使用的端口概念(通常)实际上实现为在对方法进行调用之后由包含对象调用成员对象的方法.包含对象. 这有点像Facade或Delegation模
在UML复合结构图中:什么是“端口”?我会如何实现一个,比如说 Java?

解决方法

我会提出,在像Java这样的OO语言中,复合结构图所使用的端口概念(通常)实际上实现为在对方法进行调用之后由包含对象调用成员对象的方法.包含对象.

这有点像Facade或Delegation模式,除了包含对象实际上必须“拥有”成员对象.

有关多种语言的示例实现,请参阅Delegation WikiPedia文章.

要回答问题的第一部分,请参阅UML用户手册(第2版)(诚然与组件有关):

A port is an explicit window into an encapsulated component. In an encapsulated
component,all of the interactions into and out of the component pass through ports. The externally visible behavior of the component is the sum of its ports,no more and no less. In addition,a port has identity.

…并从UML提取(第3版):

Ports allow you to group the required and provided interfaces into logical interactions that a component has with the outside world.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读