Difference Between Cohesion and Coupling


The most basic difference between cohesion and coupling is that coupling is the representation of relationships between modules which uses the concept of inter−module, while cohesion is the intramodule representation of the relationship between modules.

Read this article to find out more about Cohesion and Coupling and how these two important concepts are different from each other.

What is Cohesion?

In computer programming, cohesion is an indication that shows the relationship within modules. Cohesion provides the information about the functional strength of the modules. The greater the cohesion, the better will be the program design.

Cohesion is basically the dependency between internal elements of modules like methods and internal modules. High cohesion will allow us to reuse the classes and methods.

There are three most popular types of cohesion, namely, functional cohesion, sequential cohesion, and logical cohesion.

What is Coupling?

In software development, coupling is the indication that shows the relationship between modules or we can say the interdependence between modules.

There are two types of coupling, namely, tight coupling and loose coupling. Loose coupling is frequently used because changing one class through loose coupling will not affect another class. Hence, it reduces dependencies on a class. Consequently, we can easily reuse it. But, in case of tight coupling, the classes and objects are dependent on each other and hence it reduces the re−usability of the code.

Now, let us discuss the differences between cohesion and coupling in detail.

Difference between Cohesion and Coupling

The following table highlights all the important differences between cohesion and coupling −

Cohesion Coupling
Cohesion is the measure of degree of relationship between elements of a module. Coupling is the measure of degree of relationship between different modules.
It is an intra module concept. It is an inter module concept.
It represents relationships within the module. It helps represent the relationships between the modules.
Increased cohesion is considered to be good for the software. Increased coupling has to be avoided in software.
It represents the functional strength of the modules. It represents the independence among the modules.
When modules are highly cohesive, a high quality software is built. When the modules are loosely coupled, it results in a high quality software.
In cohesion, module focuses on the single thing. The modules would be connected to each other.

Conclusion

Both cohesion and coupling are very useful in software development. The most significant difference between cohesion and coupling is that cohesion improves the functional strength of a module, whereas coupling increases the independency on other modules. Thus, software developers can improve the design of software by understanding these key aspects of coupling and cohesion.

Updated on: 20-Dec-2022

18K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements