Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relational Cohesion at Module Level for C++ #680

Open
mcserep opened this issue Nov 14, 2023 · 0 comments · May be fixed by #747
Open

Relational Cohesion at Module Level for C++ #680

mcserep opened this issue Nov 14, 2023 · 0 comments · May be fixed by #747
Assignees
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.

Comments

@mcserep
Copy link
Collaborator

mcserep commented Nov 14, 2023

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.

@mcserep mcserep added Kind: Enhancement 🌟 Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin. Level: Intermediate (3) labels Nov 14, 2023
@kmkristof kmkristof self-assigned this Nov 17, 2023
@mcserep mcserep added this to the Upcoming Release milestone Apr 29, 2024
@kmkristof kmkristof linked a pull request May 8, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
Status: To do
Status: To do
Development

Successfully merging a pull request may close this issue.

2 participants