Saturday, August 4, 2018

Afferent & Efferent Coupling

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 coupling measures how many classes depend on a given class. A good way to remember afferent is that classes with high afferent will affect other classes when changes are made.

High afferent coupling indicates that the concerned assemblies have many responsibilities.

Efferent couplings (Ce): 

The number of classes in other packages that the classes in a package depend upon is an indicator of the package's dependence on externalities.

Efferent coupling measures the number of classes on which a given class depends. A good way to remember efferent (versus afferent) is that classes with high efferent coupling will receive the effects of changes or defects in other classes.

High efferent coupling indicates that the concerned assembly is dependent.

Note: This theory and metrics have been first introduced by the excellent book Agile Software Development: Principles, Patterns, and Practices in C# Robert C. Martin (Prentice Hall PTR, 2006)

Gotta’ love this comment on SE, “If only they had picked more confusing terms that sounded even more alike...”

Sources:
•    https://en.wikipedia.org/wiki/Software_package_metrics 
•    http://www.informit.com/articles/article.aspx?p=1561879&seqNum=3
•    http://www.ndepend.com/docs/code-metrics
•    http://softwareengineering.stackexchange.com/questions/182510/when-is-efferent-afferent-coupling-good-or-bad

No comments:

Post a Comment