CSC/ECE 517 Summer 2008/wiki3 4 bk
Cohesion Explained
Cohesion is an element of object-oriented programming related to how well or how poorly a component of a program is compartmentalized. High cohesion is the preferable state in which a component's implementation and "awareness" is contained within the respective component. Low cohesion is the undesirable state in which the implementation crosses over the boundaries of the component into the rest of the program. In short, the component encapsulates its implementation. By adhering to the principle of encapsulation and forcing a program's components to remain compartmentalized, the process of implementing, testing, and maintaining the application become much more straightforward [Pressman]. Cohesion should not be confused with the closely related object-oriented design concept of coupling. Coupling is the degree to which modules interact with one another. While a high level of cohesion is desirable, a minimal level of coupling in which modules intercommunicate as little as possible is the goal of a well thought out design.