Relational Cohesion is the average number of internal relationships per type. The relational cohesion represents the relationship that a module has to all its types.
While coupling takes into account all kinds of dependencies (e.g. types of function parameters) and examines the dependencies of different layers in a top-down direction, cohesion examines the relationships between things on the same level.
Possible computation (defined by CppDepend):
Let R be the number of type relationships that are internal to a module (i.e that do not connect to types outside the module). Let N be the number of types within the ~project~ module.
Then H is the relational cohesion, computed as: H = (R + 1)/ N
Note: the extra 1 in the formula prevents H=0 when N=1.
Recommendation:
As classes inside a module should be strongly related, the cohesion should be high. On the other hand, too high values may indicate over-coupling. A good range for relational cohesion is 1.5 - 4.0.
Relational Cohesion is the average number of internal relationships per type. The relational cohesion represents the relationship that a module has to all its types.
While coupling takes into account all kinds of dependencies (e.g. types of function parameters) and examines the dependencies of different layers in a top-down direction, cohesion examines the relationships between things on the same level.
Possible computation (defined by CppDepend):
Let R be the number of type relationships that are internal to a module (i.e that do not connect to types outside the module). Let N be the number of types within the ~project~ module.
Then H is the relational cohesion, computed as:
H = (R + 1)/ N
Note: the extra 1 in the formula prevents H=0 when N=1.
Recommendation:
As classes inside a module should be strongly related, the cohesion should be high. On the other hand, too high values may indicate over-coupling. A good range for relational cohesion is 1.5 - 4.0.