Software Design
Introduction
Design phase transforms SRS
document:
into a form easily implementable in
some programming language.
SRS Document Design Documents
Design Activities
Items Designed During
Design Phase(Outcomes)
1. module structure
(Module= Colln of funcs & data shared by these funcs)
2. control relationship among the modules
3. interface among different modules,
identify exact data items exchanged among
different modules,
4. data structures of individual modules,
5. algorithms for individual modules.
Module Structure
Introduction
A module consists of:
1. several functions
2. associated data
D1 ..
D2 ..
D3 ..
Data
F1 .. Functions
F2 ..
F3 ..
F4 ..
F5 ..
Introduction
Design activities are usually classified into
two stages:
1. preliminary (or high-level) design
2. detailed design.
High-level design
Identify:
1. modules
2. control relationships among modules
3. interfaces among modules.
d1 d2
d3 d1 d4
High-level design
The outcome of high-level design:
program structure (or software architecture).
Detailed design
For each module, design:
1. data structure
2. algorithms
Outcome of detailed design:
module specification.
What Is Good Software
Design?
Correctness: Should implement all
functionalities of the system correctly.
Understandable: Should be easily
understandable.
Efficient: Should adequately address
resource, time, and cost optimisation
issues
Maintainability: Should be easily
able to change
What Is Good Software
Design?
Understandability of a design
is a major issue:
determines goodness of design:
a design that is easy to
understand: also easy to
maintain and change.
What Is Good Software
Design?
Unless a design is easy to understand,
tremendous effort needed to maintain it.
We already know that about 60% effort is
spent in maintenance.
If the software is not easy to understand:
maintenance effort would increase many
times.
Understandability
--Use consistent and meaningful names
for various design components,
--Design solution should consist of:
a cleanly decomposed set of modules
(modularity),
--Different modules should be neatly
arranged in a hierarchy:
in a neat tree-like diagram.
*** Means understandable design is modular
and layered
Modularity
Modularity is a fundamental attribute
of any good design.
Decomposition of a problem cleanly into
modules:
1. Modules are almost independent of
each other
2. divide and conquer principle.
Modularity
If modules are independent:
modules can be understood
separately.
reduces the complexity greatly.
Example of Cleanly and
Non-cleanly Decomposed
Modules
Modularity
In technical terms, modules should
display:
1. high cohesion
2. low coupling.
Cohesion and Coupling
Cohesion is a measure of:
functional strength of a module.
A cohesive module performs a single
task or function.
Coupling between two modules:
a measure of the degree of
interdependence or interaction
between the two modules.
Cohesion and Coupling
A module having high cohesion
and low coupling:
functionally independent of other
modules:
A functionally independent module
performs a single task and has
minimal interaction with other
modules.
Advantages of Functional
Independence
Better understandability and good
design:
Complexity of design is reduced,
Different modules easily understood
in isolation:
modules are independent
Advantages of Functional
Independence
Functional independence reduces
error propagation.
degree of interaction between
modules is low.
an error existing in one module does
not directly affect other modules.
Reuse of modules is possible.
Classification of
Cohesiveness
functional
sequential
communicational Degree of
procedural cohesion
temporal
logical
coincidental
Coincidental cohesion
The module performs a set of tasks:
which relate to each other very loosely,
if at all.
the module contains a random collection
of functions.
functions have been put in the module
out of pure coincidence without any
thought or design.
Example of coincidental cohesion
Module Name: Random-operations
Functions:
Issue-book
create member
request librarian leave
Logical cohesion
All elements of the module perform similar operations
such as error handling, data input, data output, etc.
Example: a module containing set of print functions for
generating reports such as grade sheet, salary slip,
annual reports etc.
Temporal cohesion
The module contains functions that are
related by the fact that all the functions
must be executed in the same time span.
Example: Booting process of system, shut-
down of system
Procedural cohesion
If the set of functions of the module are
part of a procedure in which certain
sequence of steps have to be carried out in
a certain order for achieving an objective.
These functions may work towards different
purpose and operate on different data.
e.g. 1. algorithm for decoding a message.
2. order processing module by sales clerk
containing login(), check-order(), print-bill(),
place-order-to-vendor(), update-inventory().
Communicational
cohesion
If All functions of the module
Refer-to or update the same data
structure.
Example:
the set of functions defined on an
array or a stack. Admit-students,
enter-marks, printgradesheet etc
Sequential cohesion
If the Elements of a module forms
different parts of a sequence,
output from one element of the
sequence is input to the next.
Example: sort
search
display
Functional cohesion
If the Different elements of a
module cooperate to achieve a
single task.
Example: 1. a module containing all the
functions required to manage employees’s
payroll shows functional cohesion
computeOvertime()
computeWorkHours()
computeDeductions()
2. Module-name: managing-book-lending
Functions: issue-book(), return-book(),
query-book()