Q1: What
are the six types of the interaction coupling? Give one example of good
interaction coupling and one example of
bad interaction coupling.
Answer:
There are six types of interaction coupling:
Data:
Simply we can define Data coupling as the dependence
of software component on data not
exclusively under the control of that
software component. It includes the local and global variables which are
passed through parameters.
Stamp:
Stamp coupling is defined as it occurs between
modules when data is passed by parameters using a data structure containing
fields which may be used or not.
Control:
In control coupling in which one component of
the software influences the execution of another software component. control
coupling occurs when one module passes data that is used to control the flow of
execution of another module.
Common:
In Common data coupling we can use global data
as communication between the modules.
Content:
Content coupling is defined as the module
refers to the inside of another module. It changes the internal working of another module.
No data coupling:
When modules don’t depends on other modules
simply we can say independent modules:
Example
of good interaction coupling : Data coupling is the best.
Object to pass the value of a variable along
with a message. i.e. The object invoice could send a calculate tax the taxable
amount .
Example of bad interaction coupling: Content coupling is the worst interaction
coupling.
Where a global data area exists outside the
objects. i.e. A table users preference may simply be available for access and
change by a variety of objects.
Q2: What are the seven types of method
cohesion?
Seven types of method cohesion:
Coincidental:
In this type of cohesion there is no specific
relationship between the modules.
Coincidental
cohesion is when parts of module are grouped arbitrarily only
relationship between the parts they grouped together.
A module that only has coincidental cohesion is
one supporting tasks that have no
meaningful relationship to another.
Functional :
In this type of cohesion no element doing
unrelated activities.
A functionally cohesive module is when parts of
a module are grouped because they all contribute to a single well defined tasks
of the module i.e. lexical analysis of XML string. Object oriented languages
support this level of cohesion.
Sequential:
When parts of module are grouped because the
output from one part is the input to another part like an assembly line. For
example we can say a function which reads data from a file and process the
data.
It has good coupling and is easily maintained.
Communicational:
A module is said to be Communicationally cohesive If all functions of the module refers to the
same data structure or we can simply elaborate as is one
which performs several functions on the same input or output data.
Procedural:
In this cohesion elements are unrelated. We can
explain as When parts of modules are grouped because they allows to follow a certain sequence of execution and commonly
found at the top of the hierarchy such as the main program. steps have to be
carried out for achieving an objective.
Communicational:
Communicationally cohesive module is one whose
elements perform different functions , but each function references the same
output.
Logical:
A logical cohesion is when parts of module are grouped because they are logically
categorized to do the same thing if they are different by nature.
Example of good method cohesion : Functional cohesion is best
An object calculate tools may keep running
total of the quantity times price subtotal for each item .
Example of bad method cohesion : Coincident cohesion is worst
Unrelated activities in the same method.
0 Comments