Module Coupling definition
- It is a code quality metric.
- Module coupling is one of the most important metrics in software design.
Module Coupling purpose
- It gives us the clue how good we are at using types defined in other modules.
Module Coupling calculation
- There are two kinds of couplings :
- efferent coupling (Fan-out)
- afferent coupling (Fan-in)
- Total coupling of a module is calculated by summing up its efferent and afferent coupling.
Module Coupling practice
- Whenever a class is coupled to a class from another module, we say that its containing module is also coupled to the other module.
- Module coupling is measured by counting classes from other modules that it is coupled with.
- Of course, one class may couple with another class from the same module.
- Such pair of classes does not contribute to module coupling because it evens out.
- In other words, we can measure efferent coupling of a module as the count of classes from other modules that classes from this module know about.
- Conversely, afferent coupling of a module is the count of classes it contains that classes from other modules know about.
More informations for the Scrum PSD certification here.