You are on page 1of 3

SOFTWARE ENGINEERING TECHNIQUES

LESSON 13:

Topics Covered another application. A good software design should have the
Software Design- Features of a good software design, Cohesion following desirable characteristics:
and Coupling, Classifications of cohesion and coupling • A good design should capture all the functionalities of the
Objectives system correctly.
Upon completion of this Lesson, you should be able to: • It should be easily understandable.
• Know what is meant by software design • It should be efficient.
• Know what are the good features of a software design • It should be easily maintainable.
Know what is meant by cohesion and coupling in software Understandability of design is a major factor, which is used to
design and the various classifications of cohesion and coupling evaluate for the goodness of a design, since a design is easily
In today’s lecture we’ll see what do you exactly mean by a understandable it is also easy to maintain and change, unless a
software design and the features of a good software design as design is easily understandable it would require a tremendous
well as cohesion and coupling. effort to maintain it. In order to enhance the understand ability
of a design, it should have the following features.
What is a software design?
• Use of consistent and meaningful names for various design
Software Design components
Design phase of software development deals with
• Use of a cleanly decomposed set of modules
transforming the customer requirements as in the SRS
document into a form implementable using a programming • Neat management of modules in a hierarchy, tree like
language. In order to be easily implementable in a conventional diagram
programming language, the following items must be designed Modular design is one of the fundamental principles of a good
during the design phase: design. Decomposition of a problem into modules facilitates
• Different modules required to implement the design taking advantage of divide and conquer principle. If different
solution. modules are almost independent of each other then each
• Control relationship among the identified modules, i.e. the
module can be understood separately eventually reducing
call relationship among modules. complexity greatly.

• Interface among different modules ie, details off data items


Clean decomposition of a good design in to modules means
exchanged among different modules. that the modules in a soft ware design should display high
cohesion and low coupling. We will shortly introduced the
• Data structures of individual modules
concept of cohesion and coupling and discuss what these terms
• Algorithms required to implement individual modules. mean.
Thus the goal of the design phase is to take the SRS in Neat arrangement of modules in a hierarchy means
document as the input and to produce the above-mentioned
• Low fan out
items at the completion stage of design phase. A good software
design is seldom arrived through a single step procedure that • Abstraction
goes through a series of steps. We can broadly classify various Cohesion and Coupling
design activities into two important parts: A good software design implies clean decomposition of a
i. Preliminary design problem into modules and arrangement of these modules in a
neat hierarchy. The primary characteristics of a clean
ii. Detailed design
decomposition are high cohesion and low coupling.
What is a Good Software Design? Cohesion is the measure of the functional strength of a
Judging the goodness of design involves many subjective module where as coupling of module with another module is
factors, which depend on a particular application. EG: - A the measure of degree of functional independence or
embedded software may have to be implemented in a limited interaction between two modules.
series of memory and therefore one may have to sacrifice design
comprehensibility in order to achieve compactness while of A module having high cohesion and low coupling is said to be
code. Therefore for embedded applications, factors like design functionally independent of other modules. By the term
comprehensibility may take a back seat while judging a functional independence we mean that a cohesive module
goodness of a design. In other words a design solution, which performs a single task or function. A functionally independent
can be judged good for one application, may not be good for module has minimal interactions with other modules.

© Copy Right: Rai University


48 3E.253
Functional independence is the key to good design primarily Functional Cohesion : A functional cohesion is said to exist if

SOFTWARE ENGINEERING TECHNIQUES


due to following reasons: different elements of the cohesion cooperate to achieve a single
• Functional independence reduces error propagation. function. Eg:- Managing an employees pay roll.
Therefore, an error existing in one module is not directly When a module displays functional cohesion and if we are
affects other modules and also error existing in other asked to describe what the module does we can describe it using
modules does not directly affect this module. a single sentence.
• Re-use of a module is possible, because each module
performs some well Coincidental Logical Temporal Procedural Communicational Sequential Functional
defined and precise
function and the interface Low High
of the module with other
modules is simple and minimal. Therefore any such module
Classification of Coupling
can be easily taken out and reused in a different program
Coupling indicates how closely two modules interact or how
• Complexity of a design is reduced because different modules independent they are. The degree of coupling between two
can be understood in isolation as modules are more or less modules depends on their interface complexity. Five types of
independent of each other. coupling can occur between two modules:
Even though no quantitative measures are available to Data Coupling: Two modules are data coupled if they
determine the degree of cohesion and coupling, a communicate via an elementary data item that is passed as a
understanding of different kinds of cohesion and coupling will parameter between the two. E.g.: Integer, float, character
give us some idea regarding the degree of cohesiveness of a
This data item should be a problem related and not used for
module. Therefore by examining the type of cohesiveness
the control purpose.
exhibited by a module, we can roughly tell whether it displays
high or low cohesion. Stamp Coupling: Two modules are stamp coupled if they
communicate via a composite data item such as a record in
Classifications of Cohesiveness PASCAL or a structure in ‘C’.
The different classes of cohesiveness that can exist in a design
Control Coupling: Control coupling exists between two
are depicted.
modules, if data from one module is used to direct the order
A module is said to have coincidental cohesion if it performs a of execution of instructions in another. An example of control
set of tasks that are related to each other very loosely. In case the coupling is a flag set in one module and tested in other module.
module contains random collection of functions. In this case it
Common Coupling : Two modules are common couples if
is likely that the functions have been put in the module out of
they share some global data areas.
pure coincidence without pure thought or design.
Content Coupling: Content coupling exists between two
Logical cohesion : A module is said to be logically cohesive, if
modules if their code is shared. Eg:- Branch from one module
all the elements of the similar operations e.g. error handling,
to another module.
data input data out put etc. An example of logical cohesion is
cases where a set of print functions generating an output report The degree of coupling is in ascending order from data
has been arranged in a single module. coupling to content coupling.
Temporal Cohesion : When a module contains tasks that are The different types of coupling are as given below.
related by the fact that all tasks must be executed in the same
Data Stamp Control Common Content
time span, the module is said to exhibit temporal cohesion.
The set of functions responsible for initialization start up, shut Low High
down of the same process etc exhibit temporal cohesion.
Procedural cohesion : A module is said to possess procedural
cohesion if the set of functions of the modules are all part of Effect on
procedure in which certain sequence of steps has to be carried Clean- overall
out in certain order for achieving an objective. Eg: the algorithm liness system
of Imple- Modifi- Understand- maintain-
for decoding a message. Cohesion level Coupling mentationability ability ability
Communication cohesion: A module is said to have Functional Good Good Good Good Good
communicational cohesion if all the functions of the module Fairly
Sequential Good Good Good Good
Good
refer to or update the same data structures. Eg : the set of Communicational Medium Medium Medium Medium Medium
functions defined on an array or a stack. Procedural Variable Poor Variable Variable Bad
Sequential Cohesion : A module is said to possess sequential Temporal Poor Medium Medium Medium Bad
Logical Bad Bad Bad Poor Bad
cohesion, if the elements of the module from different parts Coincidental Bad Poor Bad Bad Bad
of a sequence, where output of one element of a sequence is
the input to the next element of the sequence.

© Copy Right: Rai University


3E.253 49
Summary Further Readings and Information Sources
SOFTWARE ENGINEERING TECHNIQUES

In this lecture, we provided a broad overview of the activities 1. W. P. Stephens, G. J. Meyers, and L. L. Constantine,
involved in software design phase. We then characterized the “Structured Design,” IBM Systems Journal, 1974, vol. 13,
features of a good software design by introducing the concepts no. 2, pp. 115-139
of cohesion and coupling. Cohesion is the measure of the
2. D. L. Parnas, On the criteria to be used in decomposing
functional relatedness of elements (instructions, data
systems into modules, Communications of the ACM, v.15
definitions, etc.) within a single module. In a good design, the
n.12, p.1053-1058, Dec. 1972
cohesion of every module is high. Together with coupling,
cohesion is one of the best measures of the quality of a design. 3. Brian W. Kernighan , P. J. Plauger, The Elements of
Programming Style, McGraw-Hill, Inc., New York, NY, 1982
A module may exhibit any of seven levels of cohesion
depending on how the activities within the module are related. 4. John B. Bowen, Module size: a standard or heuristic?,
In sequence from best to worst, these seven levels are: Journal of Systems and Software, v.4 n.4, p.327-332, Nov.
functional (elements contribute to a single, problem related 1984
activity); sequential (activities within the module are connected 5. D. N. Card, F. E. McGarry, G. T. Pager et al., The Software
in that the output from one serves as the input to another); Engineerino Laboratory, NASA/GSFC, February 1982
communicational (activities share the same input or output); 6. Glenford J. Myers, Composite Structure Design, John Wiley
procedural (activities share the same procedural & Sons, Inc., New York, NY, 1978
implementation); temporal (activities can be carried out at the
7. R. D. Cruickshank and J. E. Gaffney, “Measuring the
same time); logical (activities appear to belong to the same
Development Process: Software Design Coupling and
general category); coincidental (activities have no relationship to
Strength Matrices,” Proceedings of the Fifth Annual
one another).
Software Engineering Workshop, NASA/GSFC, November
The maintainability of modules with functional, sequential, and 1980
communicational cohesion tends to be significantly higher than
8. Thomas J. Emerson, A discriminant metric for module
that of modules of the four lowest levels of cohesion.
cohesion, Proceedings of the 7th international conference on
Exercises Software engineering, p.294-303, March 26-29, 1984,
1. What do you mean by the terms cohesion and coupling in Orlando, Florida, United States
the context of software design? How are the concepts of 9. L. A. Marascuilo and M. McSweeney, Nonparametric and
cohesion and coupling useful in arriving at good software Distribution Free Methods for the Social Sciences. California:
designs? Brooks/Cole, 1977, pp. 466-471, pp. 431-435
2. Enumerate the different types of cohesion that a module 10. F. E. McGarry, “Measuring Software Development
might exhibit? Technology,” Proceedings of the Seventh Annual Software
3. Enumerate the different types of coupling that might exist Engineering Workshop, NASA/GSFC, December 1982
between two modules? 11. Peter C. Belford , Richard A. Berg , Thomas L. Hannan,
4. Is it true that whenever you increase cohesion of different Central flow control software development: A case study of
modules in your design, coupling among these modules the effectiveness of software engineering techniques,
automatically decreases? Justify your answer through a Proceedings of the 4th international conference on Software
suitable example. engineering, p.85-93, September 17-19, 1979, Munich,
Germany
5. What according to you is a good software design?
12. Victor R. Basili , Barry T. Perricone, Software errors and
6. What do you understand by the term functional
complexity: an empirical investigation0, Communications of
independence in the context of a software design? How can
the ACM, v.27 n.1, p.42-52, Jan. 1984
you achieve functional independence in a software design?
Site Reference
Assignment
http://www.waysys.com/ws_content_bl_pgssd_ch06.html
1. Design a questionnaire to gather information about the user
interface of some tool (such as Spread sheet ) with which Notes
you are familiar. Try to distribute the questionnaire to a
number of user and evaluate the results.
2. Draw possible data flow diagrams of system design for the
following.You may make reasonable assumptions.
A salary system. The input is a list of employee number who
are to be paid that month The system maintains tables holding
tax rates and the annual salary for each employee. The output is
a salary slip for each employee.

© Copy Right: Rai University


50 3E.253

You might also like