Difference between Cohesion and Coupling | Cohesion vs. Coupling

Key to good design is functional independence  and key to  software quality is design.

Functional  independence is evaluated using two criteria:

1. Cohesion
2. Coupling

 

 

Cohesion Coupling
Cohesion is the indication of the relationship within module. Coupling is the indication of the relationships between modules.
Cohesion shows the module’s relative functional strength. Coupling shows the relative independence among the modules.
Cohesion is a degree (quality) to which a component / module focuses on the single thing. Coupling is a degree to which a component / module is connected to the other modules.
While designing you should strive for high cohesion i.e. a cohesive component/ module focus on a single task (i.e., single-mindedness) with little interaction with other modules of the system. While designing you should strive for low coupling i.e. dependency between modules should be less.
Cohesion is the kind of natural extension of data hiding for example, class having all members visible with a package having default visibility. Making private fields, private methods and non public classes provides loose coupling.
Cohesion is Intra – Module Concept. Coupling is Inter -Module Concept.