Common Coupling in Software Engineering
What is Coupling?
Coupling is simply a measure of the interdependence between multiple modules or we can say the dependence of two or more modules in a software development process. It addresses how programming parts are dependent on one another. For very much planned programming, there ought to be low coupling and high coupling to keep up its dependability and effectiveness.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
What is a Common Coupling?
Common coupling, also known as Global coupling can be defined as a type of coupling where different modules share some information by using the global data. Global data can be easily found in programming languages. The use of global data in common coupling can lead to unchecked error distribution and unexpected problems when changes are made. Common coupling is one of the types of coupling in which two or more modules share some global data structures. Any change performed on the global information field return and prompts every one of the modules that have gotten to the data through it. It can make some transmission errors and unidentified issues when the changes are made to global information. And this makes issues while reusing the modules and limits the capacity to deal with information access of various modules on a similar information source.
The modules in common coupling are joined together by the use of global data structures and the modules have both read/write access and can exchange the data through a global data block. We can control this coupling by reducing the use of common global data or by separation. Another way to achieve this is by designing patterns for different modules and making them suitable for attaining an acceptable design.
Example of Common Coupling :
The picture given below shows the global coupling inside a framework where four distinct modules, A, B, C, and D are sharing regular global information. In fact, even a little change in the global information store can cause issues in view of the fact that each module that has received information from the global store should be adjusted.
Common coupling goes under the classification of significant level tight coupling which isn’t attractive however, now, and again it is important inside the product configuration measure. Tight coupling implies that various modules inside a program are strongly subject to each other. Typically, common coupling offers tight coupling which decreases the module’s adaptability and re-convenience.
Fig: Tight Coupling shows that the different modules are coupled very tightly with each other. And Fig: Loose coupling given below shows that how these different modules i.e., A, B, C, and D are coupled very loosely.
Let’s see another Example :
This coupling likewise permits space for representing the advantages and obstructions related to the interaction. This type of dependency needs to be avoided because it needs more maintenance and lesser authority over the modules. Another example of this type of coupling is the login page, where the login module and the backend module are associated, as the login approval happens both in the login page level and the backend information base level.