2

This question will treat software like a tree, where:

  • Each node in the tree represents some code unit (eg class \ method \ line etc.)
  • Node X is son of Node Y if in the source code X is set in Y

Here is the definition of the term T:

T relative to Node X is the probability that any change on X will result changes in nodes that are within the sub-tree of X.

What is the term T? Cohesion or Coupling ?

idan mor
  • 23
  • 3

2 Answers2

4

Coupling would be horizontal, across nodes. Cohesion would be vertical, within the same tree. So T would be cohesion.

Two separate modules, loosely coupled, would be in separate subtrees, and a change in one would not affect the other. But if tightly coupled, a change in one might require a change in the other, even though they are in separate subtrees. Obviously this cannot be what T is.

Stomp
  • 890
  • 1
  • 6
  • 19
1

Cohesion: It is an intra-module concept and indicates relationships within modules.
Coupling: It is an inter-module concept and indicates relationships among modules.

In order to ensure a balanced flexibility and rigidity of any system or software, coupling and cohesion should be balanced.

See this reference for more details.

Atul Dwivedi
  • 1,452
  • 16
  • 29