Topic 3 Flashcards
Coupling - Theory & Analysis
What is module coupling?
The manner and degree of interdependence between software modules or components in a system.
How is coupling defined in software design?
A measure of the interdependence among modules in a computer program.
What is decoupling?
The process of reducing the interdependence between software modules or components.
What are all the types of coupling (6) ?
- Content Coupling
- Common(-environment) Coupling
- Data/Input-Output Coupling
- Control Coupling
- Hybrid Coupling
- Pathological Coupling
What is content coupling (1)?
A type of coupling where one module relies on the internal details of another module.
- best to avoid
What are the characteristics of content coupling?
- One module changes a statement in another module
- References or alters data contained inside another module
- One module branches into another module
What is the impact of content coupling on code maintainability?
It creates tightly intertwined code that is hard to understand, maintain, and modify.
What is common-environment or common coupling (2)?
A type of coupling where multiple modules share access to global data or resources.
*can read/write same files
*tight interdependence/coupling, reduce modularity, violates encapsulation & hard to maintain
When can common coupling be considered good?
When it simplifies design, ensures consistency, and reduces duplication in smaller systems.
What are the risks associated with common coupling?
Tight coupling, reduced modularity, and maintenance challenges.
What is data coupling (3)?
A type of coupling in which output from one software module serves as input to another module.
Why is data coupling considered good?
It promotes encapsulation, modularity, and maintainability.
What is control coupling (4)?
When one module controls the behavior of another by passing a control flag or parameter.
- hard to understand & maintain
- tight interdependencies
What are the pros of control coupling?
Good when it provides flexible control with minimal direct dependencies.
What is hybrid coupling (5)?
A type of coupling where different subsets of a data item’s range are used for different purposes in different modules.
What are the pros of hybrid coupling?
flexible & practical solution for integrating modules
What is pathological coupling (6)?
A type of coupling where one module affects or depends upon the internal implementation of another.
*bad
*complex, fragile & hard to maintain system
What is the ideal relationship between coupling and cohesion?
Low coupling and high cohesion.
What does high cohesion mean in software?
Each part of the software has a clear purpose and sticks to it.
Fill in the blank: A good software design aims for _______ coupling.
low
True or False: High coupling makes it easier to maintain software.
False
What is the goal of decoupling?
To create a system where components can be developed, modified, tested, and deployed independently.