为什么我们在 CRC 卡中列出合作者?

发布于 2024-08-10 07:38:31 字数 258 浏览 2 评论 0原文

在 CRC 卡中,为什么我们列出所有合作者而不是仅仅列出依赖关系。 我的意思是,如果 A 类调用 B 的函数,为什么在 B 类 CRC 协作者部分中提到 A。如果我们简单地将 A 留在 B 的 CRC 卡中会好得多,就像在 A 的 CRC 卡中已经提到的那样。这样我们也可以从 CRC 卡中找出依赖关系,如果你知道 A 需要的 B 类的函数名称,我们也可以在 A 的 CRC 卡中提及它。这将有助于快速生成类图和序列图。 通过在 A 协作者中提及 B 和在 B 协作者中提及 A 可以实现什么具体功能?

In the CRC cards why do we list all the collaborators instead of just dependency.
I mean if class A calls functions of B, why is A mentioned in the B class CRC collaborator section. It would be much better if we simply leave A in B's CRC card, as in A's CRC card B is already mentioned. This way we can figure out dependency also from CRC card, and if you know the function name of B class that A needs, we can mention that also in the A's CRC card. This would help even more by quickly generate the class and sequence diagrams.
What specific functionality is achieved by mentioning B in A collaborators and A in B collaborators?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疑心病 2024-08-17 07:38:31

因为您不想陷入协作如何发生的细节之中。可能是 A 调用 B,但也可能是 A 在消息总线上发布了 B 接收的事件,或者可能是 B 将回调对象传递给 A,A 将其消息传递给 A。将他们列为双方的合作者可以避免实际弄清楚他们将如何合作。

Because you don't want to be bogged down to the details of how the collaboration will happen. It may be that A calls out to B, but it may also be that A publishes an event on a message bus that B picks up, or it may be that B passes a callback object to A to which A passess its messages. Listing them as collaborators on both sides avoids having to work out actually how they will collaborate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文