3 December 2024

Efferent Coupling

Efferent Coupling definition

  • It is a code quality metric.
  • Efferent coupling is a coupling metric in software development.
    • It measures the number of data types a class knows about.
    • Efferent coupling is a coupling metric in software development, it measures the number of data types a class knows about.
    • This includes inheritance, interface implementation, parameter types, variable types, and exceptions.

Efferent Coupling purpose

  • This metric identifies the number of classes inside this component that depend on classes outside the component.

Outgoing dependencies (Fan-out)

  • Efferent (outgoing) couplings = Who do you depend on.
    • Measure of how many different packages are used by a specific package.
    • Efferent couplings signal outward.
    • This has also been referred to by Robert C. Martin as the Fan-out stability metric which in his book Clean Architecture he describes as Outgoing dependencies.

Efferent coupling calculation

  • This metric is often used to calculate instability of a component in software architecture
    • I= Fan-out / (Fan-in + Fan-out).
    • This metric has a range [0,1].
    • I = 0 is maximally stable while I = 1 is maximally unstable.
    • Instability of a class or a module is the ratio between its efferent coupling and total coupling.
    • Obviously, instability is a value between 0 and 1, inclusive.
    • Instability of zero means that the class or module is absolutely stable. It depends on nobody, everybody depend on it.
    • A large efferent coupling can indicate that a class is unfocused and may also indicate that it is unstable since it depends on the stability of all the types to which it is coupled.

Efferent Coupling practice

  • Efferent coupling measures the number of classes on which a given class depends and has the following characteristics :
    • Efferent Coupling determines the number of classes in other packages that the classes in a package depend upon.
    • Efferent Coupling is an indicator of the package’s dependence on externalities.
    • Classes with high efferent coupling will receive the effects of changes or defects in other classes.
  • Efferent Coupling includes inheritance, interface implementation, parameter types, variable types, and exceptions.
    • This has also been referred to by Robert C. Martin as the Fan-out stability metric which in his book Clean Architecture he describes as Outgoing dependencies.
    • The term “stable” itself indicates the desired quality of such class or module.
    • We want such class never to change, we want it to be absolutely stable, or otherwise we will have to maintain other classes that depend on it whenever we change it.
    • Instability equal to one means that the class or module is absolutely instable.
    • It depends on other classes and must be changed when other classes are changed.
    • On the other hand, changing this class means nothing to others.
    • That is why we call it “absolutely instable” – we can change it liberally and no harm will be done to other parts of the system.

Scrum and Metrics

The Scrum framework

More informations for the Scrum PSD certification here.

Leave a Reply

Your email address will not be published. Required fields are marked *