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).

  • 相关阅读:
    Linux常用的命令
    Docker编写镜像 发布个人网站
    Linux安装docker笔记
    单例模式
    Cache一致性协议之MESI
    linux环境搭建单机kafka
    【Ray Tracing The Next Week 超详解】 光线追踪2-4 Perlin noise
    【Ray Tracing The Next Week 超详解】 光线追踪2-3
    【Ray Tracing The Next Week 超详解】 光线追踪2-2
    【Ray Tracing The Next Week 超详解】 光线追踪2-1
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6053906.html
Copyright © 2011-2022 走看看