1. Aim: To compare cohesion & coupling for given case study
2. Objectives: From this experiment, the student will be able,
● Analyzing software design by using factors such as Cohesion & Coupling
● To bring out the creativity in each student by building innovative user
friendly applications.
3. Outcomes: The learner will be able to
● To apply the core concepts and implementation guidelines of Software
Engineering to improve them
● To understand, identify, analyze and design the problem, implement using
current techniques and skills.
4. Hardware / Software Required: Any Text editor, Open source tools
5. Theory:
● Cohesion vs. Coupling
Coupling refers to the interdependencies between modules, while cohesion describes
how related are the functions within a single module. Low cohesion implies that a
given module performs tasks which are not very related to each other and hence can
create problems as the module becomes large
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
43
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:
——————-
| Staff |
——————-
| checkEmail() |
| sendEmail() |
| emailValidate() |
| PrintLetter() |
• Example of High Cohesion:
—————————–
| Staff |
—————————–
| -salary |
| -emailAddr|
—————————–
| setSalary(newSalary) |
| getSalary() |
| setEmailAddr(newEmail) |
| getEmailAddr() |
———————————-
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. One should aim for
strongly cohesive modules. Everything in module should be related to one another –
focus on the task. Strong cohesion will reduce relations between modules – minimize
coupling
● Types of Cohesion
• Functional cohesion (Most Required)
• Sequential cohesion
• Communicational cohesion
• Procedural cohesion
• Temporal cohesion
• Logical cohesion
• Coincidental cohesion (Least Required)
44
● Determining Module Cohesion
● Determining Module coupling
For data and control flow coupling:
• di: number of input data parameters
• ci: number of input control parameters
• do: number of output data parameters
• co: number of output control parameters
For global coupling:
• gd: number of global variables used as data
• gc: number of global variables used as control
For environmental coupling:
• w: number of modules called (fan-out)
• r: number of modules calling the module under consideration (fan-in)
Coupling(C) makes the value larger the more coupled the module is. This number ranges
from approximately 0.67 (low coupling) to 1.0 (highly coupled). For example, if a
module has only a single input and output data parameter. If a module has 5 input and
output data parameters, an equal number of control parameters, and accesses 10 items of
global data, with a fan-in of 3 and a fan-out of 4
6. Procedure:
List down modules for respective case study & compute cohesion & coupling based on
that.
45
7. Conclusion:
Software design is a creative process. To see a wrong design, we can check with the
requirements in the analysis model. To see a bad design, we need to assess the design
model and analyze the components, whether the performance can be improved by
changing the modules or the interfaces by analyzing Cohesion & Coupling. All good
software design will go for high cohesion and low coupling.
8. Viva Questions:
● Why software design is important?
● Differentiate between coupling & cohesion.
● What are different types of Cohesion?
9. References:
1. www.math-cs.gordon.edu/courses/…/Cohesion%20and%20Coupling.pdf
2. www.tutorialspoint.com/software_engineering/software_design_basics.htm
3. www.letu.edu/…/Software-Engineering/…/Pressman/pressman-ch-9-desig.
4. ourses.cs.washington.edu/courses/cse403/96sp/coupling-cohesion.htm
StudyMumbai.com is an educational resource for students, parents, and teachers, with special focus on Mumbai. Our staff includes educators with several years of experience. Our mission is to simplify learning and to provide free education. Read more about us.
GET INSTANT HELP FROM EXPERTS!
- Looking for any kind of help on your academic work (essay, assignment, project)?
- Want us to review, proofread or tidy up your work?
- Want a helping hand so that you can focus on the more important tasks?
Hire us as project guide/assistant. Contact us for more information
Leave a Reply
You must be logged in to post a comment.