http://wiki.c2.com/?CouplingAndCohesion
Coupling refers to the relationship of a module with another module. A module is said to be highly coupled with another module if changes to it will result to changes to the other module. And a module is said to be loosely coupled if a module is independent of any other modules. This can be achieved by having a stable interface that effectively hides the implementation of another module.
- maintainability – changes are confined in a single module
- testability – modules involved in unit testing can be limited to a minimum
- readability – classes that need to be analyzed are kept at a minimum
Cohesion refers to the measure of how strongly-related the functions of a module are. Low cohesion refers to modules that have different unrelated responsibilities. High cohesion refers to modules that have functions that are similar in many aspects.
- Readability – (closely) related functions are contained in a single module
- Maintainability – debugging tends to be contained in a single module
- Reusability – classes that have concentrated functionalities are not polluted with useless functions
Encapsulation is synonymous to information hiding. It is the process of concealing the internal representation and implementation of a class. Encapsulation shields the class from misuse and thus increases the resuability of the class. That is, it hides the implementation such that the internal structure of a class is free to change without affecting the implementation of the classes that use this particular class.