Relational Cohesion at Module Level for C++ #680
Labels
Kind: Enhancement 🌟
Level: Intermediate (3)
Plugin: C++
Issues related to the parsing and presentation of C++ projects.
Plugin: Metrics
Issues related to the code metrics plugin.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
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
projectmodule.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.
The text was updated successfully, but these errors were encountered: