0% found this document useful (0 votes)
12 views9 pages

COHESION & COUPLING

The document discusses the principles of modular design, emphasizing functional independence, cohesion, and coupling. Cohesion measures the strength of relationships within a module, while coupling measures the interdependence between modules. High cohesion and low coupling are advocated as best practices for software development to enhance maintainability and reduce complexity.

Uploaded by

kunduakash1102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views9 pages

COHESION & COUPLING

The document discusses the principles of modular design, emphasizing functional independence, cohesion, and coupling. Cohesion measures the strength of relationships within a module, while coupling measures the interdependence between modules. High cohesion and low coupling are advocated as best practices for software development to enhance maintainability and reduce complexity.

Uploaded by

kunduakash1102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

COHESION

&
COUPLING
BY
D E B R A J C H AT T E R J E E
Modular Design

Modular design reduces the design complexity and results in easier and faster implementation by allowing parallel
development of various parts of a system. We discuss a different section of modular design in detail in this section:

1. Functional Independence:
Functional independence is achieved by developing functions that perform only one kind of task and do not
excessively interact with other modules. Independence is important because it makes implementation more
accessible and faster. The independent modules are easier to maintain, test, and reduce error propagation and
can be reused in other programs as well. Thus, functional independence is a good design feature which ensures
software quality.

It is measured using two criteria:

• Cohesion: It measures the relative function strength of a module.

• Coupling: It measures the relative interdependence among modules.


Information hiding:
The fundamental of Information hiding suggests that modules can be characterized by the design decisions that
protect from the others.
In other words, modules should be specified that data include within a module is inaccessible to other modules that
do not need for such information.
The use of information hiding as design criteria for modular system provides the most significant benefits when
modifications are required during testing's and later during software maintenance.
This is because as most data and procedures are hidden from other parts of the software, inadvertent errors
introduced during modifications are less likely to propagate to different locations within the software.

BOTTOM-
TOP-DOWN UP
COHESION
Cohesion is a measure of the functional strength of a module. Thus, cohesion measures the
strength of relationships between pieces of functionality within a given module.

Suppose you listened to a talk by some speaker. You would call the speech to be cohesive, if all the sentences of the
speech played some role in giving the talk a single and focused theme. Now, we can extend this to a module in a
design solution. When the functions of the module co-operate with each other for performing a single objective,
then the module has good cohesion. If the functions of the module do very different things and do not co-operate
with each other to perform a single piece of work, then the module has very poor cohesion.

Classification of
Cohesiveness
 Functional Cohesion: Functional Cohesion is said to exist if the different elements of a module, cooperate
to achieve a single function. [issuing of book in library]

 Sequential Cohesion: A module is said to possess sequential cohesion if the element of a module form the
components of the sequence, where the output from one component of the sequence is input to the next.

T  Communicational Cohesion: A module is said to have communicational cohesion, if all tasks of the
module refer to or update the same data structure. [student module admit Student, enter Marks, print
Y GradeSheet]

P  Procedural Cohesion: A module is said to be procedural cohesion if the set of purpose of the module are
all parts of a procedure in which sequence of steps must be carried out for achieving a goal, e.g., the algorithm for

E decoding a message. [Order processing in a trading house.]

 Temporal Cohesion: When a module includes functions that are associated by the fact that all the methods
S must be executed in the same time, the module is said to exhibit temporal cohesion. When a computer is booted,
several functions need to be performed.

 Logical Cohesion: A module is said to be logically cohesive if all the elements of the module perform a
similar operation. For example Error handling, data input and data output, etc.

 Coincidental Cohesion: A module is said to have coincidental cohesion if it performs a set of tasks that are
associated with each other very loosely, if at all. [issuing of book in library]
COUPLING
Coupling between two modules is a measure of the degree of interaction (or
interdependence) between the two modules.

Intuitively, if two modules interchange large amounts of data, then they are highly
interdependent or coupled.

Classification of Coupling
 Data coupling:
Two modules are data coupled, if they communicate using an elementary data item that is passed as a parameter
between the two, e.g. an integer, a float, a character, etc. This data item should be problem related and not used
for control purposes.

 Stamp coupling:
Two modules are stamp coupled, if they communicate using a composite data item such as a record in PASCAL or a
structure in C.

 Control coupling:
Control coupling exists between two modules, if data from one module is used to direct the order of instruction
execution in another. An example of control coupling is a flag set in one module and tested in another module.

 Common coupling:
Two modules are common coupled, if they share some global data items.

 Content coupling:
Content coupling exists between two modules, if they share code. That is, a jump from one module into the code
of another module can occur. Modern high-level programming languages such as C do not support such jumps
across modules.
Differentiate between Coupling and Cohesion

Coupling Cohesion
Coupling is also called Inter-Module Binding. Cohesion is also called Intra-Module Binding.

Coupling shows the relationships between Cohesion shows the relationship within the
modules. module.

Coupling shows the Cohesion shows the module's


relative independence between the modules. relative functional strength.

While creating, you should aim for low coupling, While creating you should aim for high cohesion,
i.e., dependency among modules should be less. i.e., a cohesive component/ module focuses on
a single function (i.e., single-mindedness) with
little interaction with other modules of the
system.
In coupling, modules are linked to the other In cohesion, the module focuses on a single
modules. thing.
Why High Cohesion & Low Coupling is good for software development?

•High cohesion: Elements within one class/module should functionally belong together and
do one thing.
•Loose coupling: Among different classes/modules should be minimal dependency.

You might also like