Code quality metric tool like Sonar does provide the ability to drill down to a class and find out the number of:
What are these two parameters? Can you please describe with a simple contrived example?
According to wikipedia:
Afferent Couplings (Ca): The number of classes in other packages that depend upon classes within the package is an indicator of the package's responsibility. Afferent = incoming.
Efferent Couplings (Ce): The number of classes in other packages that the classes in the package depend upon is an indicator of the package's dependence on externalities. Efferent = outgoing.
So, if you have classes (or packages or whatever) with the following structure:
class Foo {
Quux q;
}
class Bar {
Quux q;
}
class Quux {
// ...
}
Then Foo
and Bar
each have one efferent coupling, and Quux
has two afferent couplings.