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

Afferent Coupling at Type Level for C++ #671

Open
mcserep opened this issue Nov 8, 2023 · 2 comments · May be fixed by #757
Open

Afferent Coupling at Type Level for C++ #671

mcserep opened this issue Nov 8, 2023 · 2 comments · May be fixed by #757
Assignees
Labels
Kind: Enhancement 🌟 Kind: Important 🥇 Level: Moderate (2) 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 8, 2023

Coupling is metric which can be computed for structural units at different levels (e.g. classes, namespaces, modules).
It measures how many other entities an entity depends on; and how many dependants it has.

The Afferent Coupling for a particular type is the number of types that depends directly on it.

High afferent coupling indicates that the concerned types have many responsibilities, while a zero value could indicate unused code.

@mcserep mcserep changed the title Implement Afferent Coupling at Type Level for C++ Afferent Coupling at Type Level for C++ Nov 8, 2023
@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: Moderate (2) labels Nov 8, 2023
@schaumb schaumb self-assigned this Nov 8, 2023
@schaumb
Copy link
Collaborator

schaumb commented Nov 29, 2023

Counts:

  • Member user-defined types
  • Member function parameter user-defined types
  • Member function local variable user-defined types
  • User-defined type inheritance

Remaining questions @mcserep :

  • Which user-defined types count? Only those defined in the analyzed code? How did I know whose are defined in the user space?
  • What about std::vector<A> or std::unique_ptr<A>? Are these different than A?
  • What is about MyTemplate<A> and MyTemplate<B> ? Are these different?
  • Probably when we count the classes, the std::decay_t<type> is matter (A, A* and A[4]* is not different). Is that right?

@mcserep
Copy link
Collaborator Author

mcserep commented Dec 13, 2023

Which user-defined types count? Only those defined in the analyzed code? How did I know whose are defined in the user space?

Types which are defined in files under the project root. (Given with the -i flag for the parser.) Special attention could be required for template types.

What about std::vector or std::unique_ptr? Are these different than A?

If type B uses A, std::vector<A> and std::unique_ptr<A>, then it increases the afferent coupling with 1.
If type B uses std::vector<std::map<A, C>>, then B depends on A and C as well.

What is about MyTemplate<A> and MyTemplate<B> ? Are these different?

This means all 3 types are used.

Probably when we count the classes, the std::decay_t<type> is matter (A, A* and A[4]* is not different). Is that right?

Type A should be counted here.

@mcserep mcserep assigned intjftw and unassigned schaumb Feb 28, 2024
@mcserep mcserep added this to the Upcoming Release milestone Apr 29, 2024
@mcserep mcserep linked a pull request Jul 1, 2024 that will close this issue
1 task
@kmkristof kmkristof linked a pull request Jul 1, 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 🌟 Kind: Important 🥇 Level: Moderate (2) 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.

3 participants