Mastering Cohesion and Coupling: A Software Engineering Tale

Cohesion and Coupling | Software Engineering


Cohesion and Coupling | Software Engineering

What is cohesion and coupling in software engineering ?

  • Cohesion and Coupling both are very important concepts in software engineering . A Software design is said to be a good design by it's clean decomposition  of modules and neat arrangement .
  • A neat module or a software is said to be a good software if it contains high cohesion and low coupling .
  • Cohesion can be defined as the functional strength of a module.

Cohesion and Coupling | Software Engineering


  • Functional strength means how different functions and operation inside a perticular modules are connected with each other and whats the effect to another functions when any one or two function fails to perform .
  • Coupling can be defined as the degree of interdependence or interaction betweeen two modules.
Cohesion and Coupling | Software Engineering



As you can see in the following image , cohesion is the functional strength of a module and where as coupling is the interdependance between two or more than two modules .

Cohesion and Coupling | Software Engineering



Types of Cohesion :-

                There are basically 7 types of cohesion as follows -
  • Coincidental cohesion
  • Logical cohesion
  • Temporal cohesion
  • Procedural cohesion
  • Communicational cohesion
  • Sequential cohesion
  • Functional cohesion
Cohesion and Coupling | Software Engineering


Let's see one by one each type of cohesion :-

1 - Coincidental Cohesion : 

                   In this type of cohesions tasks are not related . That means the source codes are conceptually not related other than location of other codes . coincidental cohesion is one of the most worst type of cohesion.

2 - Logical Cohesion :

                       A module can be said as logical cohesive when all the functions performing similar type of operations like error handling , data processing etc.

3 - Temporal Cohesion :

                   A module is said to be performing temporal cohesion when all the functions inside a module are perform operations in same timespan .

4 - Procedural Cohesion :

               A module is said to be performing procedural cohesion when set of functions of a module executing one after another . 

5 - Communicational Cohesion :

              When different functions of a module follows a same datastructure ( like array,stack ) for different operations like updation , insertion and deletion etc. then such modules are said to be communicationally cohessive.

6 - Sequential Cohesion :

             A module is said to be sequentially cohessive when functions of a module executing sequentially,i.e, one functions output is working as an input to the another function .

7 - Functional Cohesion :

           A module is said to be functionally cohessive where different functions of a module works / performs to achieve a single goal .


Cohesion and Coupling | Software Engineering


Now , Let's see what are the types of Coupling :-

Types of Coupling :-

             There are basically 5 types of coupling available as follows :-

  • Data Coupling
  • Stamp Coupling
  • Control Coupling
  • Common Coupling
  • Content Coupling

1 - Data Coupling :


            When data of one module passed to another module as an input , then it's called data coupling.In this process , two or more than two modules communicates using an external data .


Cohesion and Coupling | Software Engineering


2 - Stamp Coupling :

            If two modules communicates using composite data items such as record in pascal or a structure in c .

3 - Control Coupling :

             If data from one module is used to direct the order of instruction execution in another , then it's called control coupling .

4 - Common Coupling : 

         If two or more than two modules sharing same global data then it's called common coupling ,because they are using common global data .



Cohesion and Coupling | Software Engineering


5 - Content Coupling :

          Content Coupling exist between two module , if they shae code ,i.e; a jump from one module into the code of another module .

Difference between Cohesion and Couling 

Cohesion :

  • Defined as the functional - strength of a module .
  • Shows relationship inside the module .
  • You should aim for high cohesion .

Coupling :

  • Dedined as intra-module binding .
  • Shows relationship between modules .
  • You should aim for low coupling.


Thank you for reading this article...
Previous Post Next Post

Contact Form