0
23kviews
Explain in brief the different types of coupling and cohesion. Give one practical example of high cohesion and low coupling.

Mumbai University > Computer Engineering > Sem6 > Software Engineering

Marks: 10M

Year: Dec 2015

1 Answer
4
411views

Cohesion:

  • With the help of cohesion the information hiding can be done.

  • A cohesive subsystem performs only “one task” in software procedure with little interaction with other modules. In other cohesive subsystem performs only one thing.

  • Different types of cohesion:

enter image description here

1. Coincidentally cohesive: The subsystem sin which the set of tasks are related with each other loosely then such subsystems are called coincidentally cohesive.

2. Logically cohesive: A subsystem that performs the tasks that are logically related with each other is called logically cohesive.

3. Temporal cohesive: The subsystem in which the tasks need to be executed in some specific time span is called temporal cohesive.

4. Procedural cohesive: When processing elements of a subsystem are related with one another and must be executed in some specific order, such subsystems is called Procedural cohesive.

5. Communication cohesion: when the processing elements of a subsystem share the data then such subsystem is called communication cohesive.

6. Sequential cohesion: when the output of 1 subsystem is given as input for other subsystem is called Sequential cohesion.

Following fog shows layer cohesion.

Coupling:

  • Coupling effectively represents how the subsystems can be connected with other subsystem or with the outside world.
  • Coupling is a measure of interconnection among subsystems in a program structure.
  • Coupling depends on the interface complexity between subsystems.
  • The gaol is to strive for the possible coupling among the subsystems in software design.
  • The property of good coupling is that it should reduce or avoid change impact and ripple effects.it should also reduce the cost in program changes, testing and maintenance.
  • Various type of coupling:

enter image description here

5. Data coupling: The data coupling is possible by parameter passing or data interaction.

6. Control coupling: The modules share related control data in control coupling.

7. Common coupling: In common coupling common data or global data is shared among the modules.

8. Content coupling: Content coupling occurs when one module makes use of data or control information maintained in another module.

  • Example:

    • Cohesion refers to what the class (or module) will do. Low cohesion would mean that the class does a great variety of actions and is not focused on what it should do. High cohesion would then mean that the class is focused on what it should be doing, i.e. only methods relating to the intention of the class.
  • Example of Low Cohesion:

enter image description here

  • As for coupling, it refers to how related are two classes / modules and how dependent they are on each other. Being low coupling would mean that changing something major in one class should not affect the other. High coupling would make your code difficult to make changes as well as to maintain it, as classes are coupled closely together, making a change could mean an entire system revamp.

  • All good software design will go for high cohesion and low coupling.

Please log in to add an answer.