gpt4 book ai didi

oop - "uses"和 "depends upon"和有什么区别?

转载 作者:行者123 更新时间:2023-12-02 04:01:21 25 4
gpt4 key购买 nike

在此beginners guide to Dependency Injection我注意到the UML diagram区分“使用”和“取决于”。

由于两者都需要在类中“使用”或“依赖”某种形式的引用,我想知道:两者之间真正的区别是什么?

最佳答案

查看取自 IBM Rational Software Architect documentation 的有关关系类型的 block 引用。 。

“取决于”的含义如下:

A dependency relationship indicates that changes to one model element (the supplier or independent model element) can cause changes in another model element (the client or dependent model element). The supplier model element is independent because a change in the client does not affect it. The client model element depends on the supplier because a change to the supplier affects the client.

“使用”含义如下:

A usage relationship is a dependency relationship in which one model element requires the presence of another model element (or set of model elements) for its full implementation or operation. The model element that requires the presence of another model element is the client, and the model element whose presence is required is the supplier. Although a usage relationship indicates an ongoing requirement, it also indicates that the connection between the two model elements is not always meaningful or present.

正如我所读到的,“用法”是一种不太严格的“依赖关系”。

关于oop - "uses"和 "depends upon"和有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6541488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com