zoukankan      html  css  js  c++  java
  • functional cohesion

    Computer Science An Overview _J. Glenn Brookshear _11th Edition

    A weak form of cohesion is known as logical cohesion. This is the cohesion within a module induced by the fact that its internal elements perform activities logically similar in nature. For example, consider a module that performs all of a system’s communication with the outside world. The “glue” that holds such a module together is that all the activities within the module deal with communication. However, the topics of the communication can vary greatly. Some may deal with obtaining data, whereas others deal with reporting results.

    A stronger form of cohesion is known as functional cohesion, which means that all the parts of the module are focused on the performance of a single activity. In an imperative design, functional cohesion can often be increased by isolating subtasks in other modules and then using these modules as abstract tools. This is demonstrated in our tennis simulation example (see again Figure 7.3) where the module ControlGame uses the other modules as abstract tools so that it can concentrate on overseeing the game rather than being distracted by the details of serving, returning, and maintaining the score.

    In object-oriented designs, entire objects are usually only logically cohesive because the methods within an object often perform loosely related activities— the only common bond being that they are activities performed by the same object. For example, in our tennis simulation example, each player object contains methods for serving as well as returning the ball, which are significantly different activities. Such an object would therefore be only a logically cohesive module. However, software designers should strive to make each individual method within an object functionally cohesive. That is, even though the object in its entirety is only logically cohesive, each method within an object should perform only one functionally cohesive task (Figure 7.7).

  • 相关阅读:
    [VBA]根据身份证号码计算年龄的Excel函数
    [VBA]发布一个计算桩号之差的Excel自定义函数(VBA)
    [VBA]用一个简单例子说明如何在Excel中自定义函数
    元素定位工具:Chrome浏览器ChroPath插件
    68 个 Python 内置函数
    Python错误重试
    jenkins 中展示漂亮的 HTML 测试报告
    python解决接口数据使用了RSA加密和签名
    Python装饰器用法
    Pycharm中文版教程
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6053906.html
Copyright © 2011-2022 走看看