Coupling and Cohesion

Coupling and Cohesion

Coupling and Cohesion are two properties that deserve your attention when you design software. These are important because they have a direct effect on how flexible and maintainable your software will be as your software continues to e developed. Will you be able to reuse it? Will you be able to adapt it? Will you need a shoe-horn to force that new feature in the future? These questions are much simpler to answer when you can properly gauge the level of Coupling and Cohesion of your components.

Coupling and Cohesion

The source of the terms Coupling and Cohesion originated from the 1968 National Symposium on Modular Programming by Larry Constantine. A more commonly referenced source is from a later published paper called, Structured Software Design (1974), Larry Constantine, Glenford Myers, and Wayne Stevens. This paper discusses characteristics of “good” programming practices that can reduce maintenance and modification costs for software.

Loose (Low) coupling and High (Tight) cohesion are the desirable properties for components in software. Low coupling allows components to be used independently from other components. High cohesion increases the probability that a component can be reused in more places, by limiting its capabilities to small well-defined tasks. For those of you keeping score at home, high cohesion is the realization of the S, Single Responsibility, in SOLID object-oriented design.

 

Coupling

A measure of the degree to which a component depends upon other components of the system.

Low coupling is desired because it allows components to be used and modified independently from one and other. 

Cohesion

A measure of how strongly related the various functions of a single software component are.

High cohesion is desired because:

  • Leads to a simpler minimal class that embodies one concept
  • A minimal class is easier to comprehend and use
  • Therefore it is more likely that this class will be reused 

You can read the remainder of the article, including suggestions on how to improve the reuse of your code at http://codeofthedamned.com/index.php/coupling-and-cohesion

Legos images, trademarks and copyrights belong to the LEGO Group.

 

 

 

 

To view or add a comment, sign in

More articles by Paul Watt

  • Leave the Key Under the Mat

    The criticism of strong-encryption by law-enforcement has been an interesting topic to follow in the news and politics…

Others also viewed

Explore content categories