cohesion and coupling Flashcards
What is cohesion in software modules?
Cohesion is the manner and degree to which the tasks performed by a single software module are related to one another within a single module.
How many types of cohesion are there?
There are 7 types of cohesion.
Define Communicational Cohesion.
The tasks performed by a module use the same input data or contribute to producing the same output data.
Is Communicational Cohesion acceptable?
Yes, it is always acceptable.
Define Functional Cohesion.
The tasks performed by a module all contribute to the performance of a single function.
What is the significance of Functional Cohesion?
It is the foundation of object-oriented programming.
Define Logical Cohesion.
The tasks performed by a module perform logically similar functions.
Is Logical Cohesion generally considered good?
No, it is generally considered bad.
Define Procedural Cohesion.
The tasks performed by a module all contribute to a given program procedure such as an iteration or decision process.
Is Procedural Cohesion considered good?
Rarely considered good.
Define Sequential Cohesion.
The output of one task performed by a module serves as the input to another task performed by the module.
Is Sequential Cohesion acceptable?
No, it is never acceptable.
Define Temporal Cohesion.
The tasks performed by a module are all required at a particular phase of program execution.
Is Temporal Cohesion acceptable?
No, it is never acceptable.
Define Coincidental Cohesion.
The tasks performed by a module have no functional relationship to each other.
Is Coincidental Cohesion acceptable?
No, it is never acceptable.
What is coupling in software modules?
Coupling is the manner and degree of interdependence between modules.
Define Common-environment coupling.
Type of coupling in which two software modules access a common data area.
Is Common-environment coupling acceptable?
Yes, as long as modules are not operating on global data.
Define Content Coupling.
Type of coupling in which some or all of the contents of one software module are included in the contents of another module.
Provide an example of Content Coupling.
Lambda functions in C++ or Python, or event listeners.
Define Control Coupling.
Type of coupling in which one software module communicates information to another module for the explicit purpose of influencing the latter module’s execution.
Is Control Coupling considered good?
No, it is considered bad.
Define Data Coupling.
Type of coupling where output from one module serves as input to another module.