Difference Between Cohesion and Coupling in Tabular form
Cohesion refers to what the class (or module) can do.
Coupling it refers to how related or dependent two classes/modules are toward each other.
SNO. | Cohesion | Coupling |
1. | Cohesion is the indication of the relationship within module. | Coupling is the indication of the relationships between modules. |
2. | Cohesion shows the module’s relative functional strength. | Coupling shows the relative independence among the modules. |
3. | 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. |
4. | 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. |
5. | 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. |
6. | Cohesion is Intra – Module Concept. | Coupling is Inter – Module Concept. |
(Visited 609 times, 1 visits today)
Written by: