Module Coupling and Its Types
Prerequisite – Coupling and Cohesion
Coupling simply means to connect two or more things together. It means the pairing of two things. It actually measures the degree of independence between two things and how closely two things are connected or represent the strength of the relationship between them.
Module coupling means to couple two to more modules with each other and with the outside world. It generally represents how the modules are connected with another module and the outside world. Coupling is related to cohesion. Cohesion means that the cohesive module performs only one task or one thing in the overall software procedure with a small amount of interaction with other modules. With the help of cohesion, data hiding can be done. Low coupling correlates with high cohesion and high coupling correlates with low cohesion. Lower will be the coupling, higher will be the cohesion and better will be the program and these programs can be said as functionally independent of other modules.
Low coupling minimizes the “ripple effect (spreading results of any action or error or failure)” which means it reduces the effects of changes in one module that cause errors in other modules. The main aim or goal of module coupling is to make efforts to achieve or obtain the lowest possible coupling among modules in software design. The coupling is said well if it reduces the ripple effect, the cost in program changes, testing, and maintenance.
Types of Coupling :
These are following types of coupling –
- Data Coupling –
Data coupling simply means the coupling of data i.e. interaction between data when they are passed through parameters using or when modules share data through parameters. When data of one module is shared with other modules or passed to other modules, this condition is said to be data coupling.
- Control Coupling –
Control coupling simply means to control data sharing between modules. If the modules interact or connects by sharing controlled data, then they are said to be control coupled. The controlled coupling means that one module controls the flow of data or information by other modules by them the information about what to do.
- Common Coupling –
Common coupling simply means the sharing of common data or global data between several modules. If two modules share the information through global data items or interact by sharing common data, then they are said to be commonly coupled.
- Content Coupling –
Content coupling simply means using of data or control information maintained in other modules by one module. This coupling is also known as pathological coupling. In these coupling, one module relies or depends upon the internal workings of another module. Therefore, if any changes have to be done in the inner working of a module then this will lead to the need for change in the dependent module.
- Stamp Coupling –
Stamp coupling simply means the sharing of composite data structure between modules. If the modules interact or communicate by sharing or passing day structure that contains more information than the information required to perform their actions, then these modules are said to be stamp coupled.
- External Coupling –
The external coupling means the sharing of data structure or format that are imposed externally between the modules. External coupling is very important but there should be a limit also. It should be limited to less number of modules with structures.