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

functional cohesion的更多相关文章

  1. 《Code Complete》ch.7 高质量的子程序

    WHAT? 子程序(routines)是为实现一个特定目的而编写的可被调用的方法或过程.在C++中是函数(function),在Java中是方法(method),在VB中是函数过程(function ...

  2. js函数设计原则

    一般认为函数指具有返回值的子程序,过程指没有返回值的子程序.C++中把所有子程序成为函数,其实那些返回值为void的 函数在语义上也是过程.函数与过程的区别更多是语义上的区别,而不是语法的区别. 语言 ...

  3. software quality assurance 常见问题收录

    1. What is Quality? Quality means, “meeting requirements.” ..Whether or not the product or service d ...

  4. FunDA(0)- Functional Data Access accessible to all

    大数据.多核CPU驱动了函数式编程模式的兴起.因为函数式编程更适合多线程.复杂.安全的大型软件编程.但是,对许多有应用软件开发经验的编程者来说,函数式编程模式是一种全新的.甚至抽象的概念,可能需要很长 ...

  5. "Becoming Functional" 阅读笔记+思维导图

    <Becoming Functional>是O'Reilly公司今年(2014)7月发布的一本薄薄的小册子,151页,介绍了函数式编程的基本概念.全书使用代码范例都是基于JVM的编程语言, ...

  6. Beginning Scala study note(4) Functional Programming in Scala

    1. Functional programming treats computation as the evaluation of mathematical and avoids state and ...

  7. Functional Programming without Lambda - Part 2 Lifting, Functor, Monad

    Lifting Now, let's review map from another perspective. map :: (T -> R) -> [T] -> [R] accep ...

  8. Functional Programming without Lambda - Part 1 Functional Composition

    Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had lon ...

  9. titit. 深入理解 内聚( Cohesion)原理and  attilax大总结

    atitit. 深入理解 内聚( Cohesion)原理and  attilax大总结         1.1. 内聚的概念 1 1.1.1. 高内聚模式关于这个问题给出的答案是:分配职责,使其可保持 ...

随机推荐

  1. Android: 启动另外的APP及传递参数(转)

    转载自:http://blog.csdn.net/iefreer/article/details/8812585 有时候需要从一个APP中启动另外一个APP,比如Twitter/微信等. 如果你不知道 ...

  2. C#环境datagidview添加删除操作

    添加 行 dataGridView1.Rows.Add();//添加空行 dataGridView1.Rows.Add("a","b"……);//添加指定列数的 ...

  3. wrk 进程管理

    4.3.1 四种情况创建新进程并调用MmInitializeProcessAddressSpace, 调用完这个函数的时候,一个进程的地址空间基本建立了, 可执行文件的映像和ntdll.dll(内存区 ...

  4. 简单几何(线段相交)+模拟 POJ 3449 Geometric Shapes

    题目传送门 题意:给了若干个图形,问每个图形与哪些图形相交 分析:题目说白了就是处理出每个图形的线段,然后判断是否相交.但是读入输出巨恶心,就是个模拟题加上线段相交的判断,我第一次WA不知道输出要按字 ...

  5. Travelling

    Travelling Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  6. BZOJ4134 : ljw和lzr的hack比赛

    设$f[x]$为$x$子树里的子游戏的sg值,$h[x]$为$x$所有儿子节点$f[x]$的异或和,则: $f[x]=mex(y到x路径上所有点的h的异或和\ xor\ y到x路径上所有点的f的异或和 ...

  7. No FileSystem for scheme: 远程访问HDFS找不到shceme

    问题描述: hadoop版本:hadoop-2.0.0-cdh4.3.0 在本地环境下能够找到scheme,但是通过maven打包fatjar 后放到其他机器上就出现找不到scheme. 看了代码,发 ...

  8. TYVJ P1098 任务安排 Label:倒推dp 不懂

    描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间是Ti.在每批任务开始前, ...

  9. 我的conky配置

    安装conky的方法请看我博客另外一篇文章,这里不再阐述点这里 附上我的配置2013.08.29(吾喷) background no font WenQuanYi Micro Hei:size=10 ...

  10. 【BZOJ】1002: [FJOI2007]轮状病毒(DP+规律+高精度)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1002 其实我还是看题解的,而且看了题解也没明白那公式怎么来的T_T,先水过了先把....以后研究一下 ...