沟通凝聚力

发布于 2024-10-22 04:15:48 字数 116 浏览 7 评论 0原文

模块之间存在耦合和内聚。好的。存在功能和沟通的凝聚力。功能内聚是按功能分组。好的。通信内聚力是按输入/输出数据分组.. 嗯.. 不行。任何人都可以解释一下什么是沟通凝聚力或/并提供示例(任何语言,但最好是 Java)?

There are coupling and cohesion for modules. OK. There are functional and communication cohesion. Functional cohesion is grouping by functionality. OK. Communication cohesion is grouping by input/output data.. Hm.. Not OK. Can any explain me what is communication cohesion or/and provide example (any language, but Java is preferable)?

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

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

发布评论

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

评论(3

得不到的就毁灭 2024-10-29 04:15:48

首先,它被称为沟通凝聚力

我发现以下解释很清楚:

通信内聚模块是一种对相同输入或输出数据执行多种功能的模块。例如,根据传递的标志从书目记录中获取书籍的作者、书名或价格。 (注意:此示例中的功能可以彼此独立执行,应该分开以获得更大的灵活性。当将通信内聚的模块分离为功能内聚的模块时,可维护性通常会得到提高。)

为了与其他类型的内聚进行比较,引用的文章似乎很清楚。

正如示例所示,与沟通内聚相比,更喜欢功能内聚(甚至顺序内聚)非常重要。

通信凝聚力在面向对象的系统中很少见,因为面向对象的设计往往强调多态性。

First of, it's called Communicational Cohesion.

I found the following explanation clear:

A communicationally cohesive module is one which performs several functions on the same input or output data. For example, obtain author, title, or price of book from bibliographic record, based on a passed flag. (Note: The functions in this example could be performed independently of each other and should be separated for greater flexibility. Maintainability is usually improved when you separate a communicationally cohesive module into functionally cohesive modules.)

For a comparison with the other types of cohesion, the referenced article seems really clear.

As the example states, it's important to prefer functional cohesion (or even sequential cohesion) over communicational cohesion.

Communicational cohesion is rare in object-oriented systems since object-oriented designs tend to stress polymorphism.

薄荷港 2024-10-29 04:15:48

这只是我的解释,但我想说“通信凝聚力”意味着使用相同数据的代码被放置在一起,并与该数据放在一起。 “Together”可以意味着它们在同一个包或JAR中,这意味着优点主要在于可维护性。或者它可能意味着它位于相同的硬件或相同的 LAN 上,这具有性能和安全优势。

This is just my interpretation, but I'd say that "communication cohesion" means that code that works with the same data is placed together, and together with that data. "Together" can mean that it's in the same package or JAR, which means the advantage is mainly in maintainability. Or it can mean that it lives on the same hardware or the same LAN, which has performance and security benefits.

卖梦商人 2024-10-29 04:15:48

据推测,通信凝聚力涉及开放标准协议和格式的使用。例如 HTTP、JSON 等。

ETA:维基百科说:

通信凝聚力是指模块的各个部分由于对相同数据进行操作而被分组(例如,对相同信息记录进行操作的模块)。

Presumably communication cohesion involves the use of open standard protocols and formats. e.g. HTTP, JSON, etc.

ETA: Wikipedia says:

Communicational cohesion is when parts of a module are grouped because they operate on the same data (e.g. a module which operates on the same record of information).

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