Selamu Samuel
Selamu Samuel
UNIVERSITY
COLLEGE OF ELECTRICAL AND MECHANICAL
ENGINEERING
SOFTWARE DEPARTMENT
1. Week cohesion
1.1. Coincidental Cohesion
This is the weakest form of cohesion. Tasks within a module are linked simply because they are
within the same module. Here the modules are completely random. There is nothing linking the
tasks in the module other than the fact that the tasks were put in the same file. This example is a
single file project. The only reason they are all in the same file is because no additional files are
created. There is basically no organization. Coincidental cohesion occurs when elements in a
module are grouped arbitrarily. There is no relationship among the different elements, making it
the lowest (worst) type of cohesion. Sometimes, you will see this type of cohesion in
a utilities or helpers class where a number of unrelated functions have been placed together.
Coincidental cohesion should be avoided and, if it is encountered in a module, the module should
be refactored. Each part of the module should be moved to an existing or new module where it
would make logical sense for it to exist.
Logical cohesion is the grouping of parts of modules. Even though they are essentially different,
they are grouped logically to do the same. A logically combined module is a module whose
elements perform similar activities and the activities to be performed are selected outside the
module. Modules exhibit logical cohesion when elements are grouped together because they are
related in some way logically. Even though the functionality of logically cohesive modules might
be of the same general category, they may be different in other ways. For this reason, this type of
cohesion is considered low. While better than coincidental cohesion, these types of modules are
not very cohesive.
2. Medium Cohesion
2.1. Procedural Cohesion
In this type of cohesion elements of module are grouped together, which are executed
sequentially in order to perform a task. In Procedural cohesion, the sequential flow is of the
functionality i.e., a particular function has to performed before another function or in a certain
order e.g. - In opening a file, the first functionality is to check the file permissions and then open
the file accordingly. So there is a certain order of functionality.
Communicational cohesion is the third highest cohesion model among all other cohesion models.
In this following cohesion model, each component performs different functions and the
references of each function have the same input or output information. For example, in a school,
a school manager enters and updates the record of a student into the school’s database system
In this type of cohesion different functions of the module executes in sequence and the output
from one function is required as the input for the other module in the sequence. In this process,
the tasks are not only linked through a time requirement, they are also linked through a data
requirement. The level of organization within the module has increased quite a bit from the start.
However, we can still do better.
3. Strong cohesion
3.1. Functional cohesion
In this type of cohesion all elements contribute to the execution of one and only one problem-
related task. No elements doing unrelated activities. Functional cohesion occurs when modular
elements are grouped together because they are combined for a single, well-defined purpose. All
elements of the module work together to achieve single goal. Functional cohesion within
modules is ideal and the highest form of cohesion. Functional cohesion promotes module
reusability and maintenance. Examples of functionally consistent modules include a module
responsible for reading a specific file and a module calculating shipping costs for an order.
In this type of cohesion all activities modify a single object. This only works in object-oriented
languages. An example might be a module that only modifies a user object. All tasks within this
module update the user module in some way.
Types of coupling
1. Common coupling
Common coupling is one of the forms of coupling in which two or more modules share
some global data such as global data structures. Different modules read from and write their
data to a common global field that has some information regarding the operations to be
performed is an example of common coupling. Any change performed on global data field
leads to back track all the modules that have accessed the information through it. Common
coupling may create undesirable error transmission and unpredicted issues when changes are
made to global data. This creates complications while re-using modules and minimizes the
ability to handle data access of different modules on the same data source.
2. Content coupling
Content coupling, as the name implies, is a case where two modules share their contents, and
when a change is made in one module, the other module needs to be updated as well. When the
modules are not in sync, it leads to higher levels of functional misbehavior. For instance, when
two modules share the same data, the primary key columns in both modules’ databases should
be related, or else the content of the modules will reflect non-sync data due to the dependency.
3. Data coupling
Data coupling is a form of coupling in software engineering. The measure of dependencies that
exists between two modules of a software program is called coupling. Depending on the
measure of dependencies, they can be termed as tight coupling and loose coupling. If the
degree of dependencies in the program modules is higher, the coupling is said to be tight
coupling. If the degrees of dependencies are lesser, the coupling is said to be loose coupling.
4. Control coupling
There are many types of coupling methods use in the software engineering system. Control
coupling is one of those important coupling methods used in software designing system. n the
control coupling process, the modules are communicating with each other by passing the data on
control information of the module. It controls the flow of another module by passing the
information on dos and don’ts.
5. Stamp coupling
In this type of coupling modules communicate using composite data items such as structure,
objects, etc. When the module passes non-global data structure or entire structure to another
module, they are said to be stamp coupled
Reference
1. https://www.chegg.com/learn/computer-science
2. Geeks for Geeks
3. https://www.javatpoint.com/software-engineering-coupling-and-cohesion