Professional Documents
Culture Documents
Software Design
Software Engineering
Software Design
Slide 1
Software Design
Software Engineering
Software Design
Slide 2
Stages of Design
Problem understanding
Look at the problem from different angles to discover the
design requirements.
Software Design
Slide 3
Software Design
Slide 4
Abstra ct
spe c if ictio
a
n
I nter fa c e
design
Com pone nt
design
Data
struc tur
e
design
Algorithm
design
Sy stem
a rc hite c tur
e
Sof twa re
spe c if iction
a
I nter fa c e
spe c if iction
a
Com pone nt
spe c if iction
a
Data
struc tur
e
spe c if iction
a
Algorithm
spe c if iction
a
De sign pr
oduc ts
Software Engineering
Software Design
Slide 5
Design Phases
Software Design
Slide 6
Design
Computer systems are not monolithic: they are usually
composed of multiple, interacting modules.
Modularity has long been seen as a key to cheap, high
quality software.
The goal of system design is to decode:
What the modules are;
What the modules should be;
How the modules interact with one-another
Software Engineering
Software Design
Slide 7
Modular programming
In the early days, modular programming was
taken to mean constructing programs out of
small pieces: subroutines
But modularity cannot bring benefits unless the
modules are
autonomous,
coherent and
robust
Software Engineering
Software Design
Slide 8
Procedural Abstraction
The most obvious design methods involve
functional decomposition.
This leads to programs in which procedures
represent distinct logical functions in a program.
Examples of such functions:
Display menu
Get user option
Software Design
Slide 9
Programs as Functions
Another view is programs as functions:
input
output
x f f (x)
Slide 10
Object-oriented design
The system is viewed as a collection of
interacting objects.
The system state is decentralized and each
object manages its own state.
Objects may be instances of an object class
and communicate by exchanging methods.
Software Engineering
Software Design
Slide 11
Modular decomposability;
Modular composability;
Modular understandability;
Modular continuity;
Modular protection.
Software Engineering
Software Design
Slide 12
Modular Decomposability
This criterion is met by a design method if the
method supports the decomposition of a problem
into smaller sub-problems, which can be solved
independently.
In general method will be repetitive: subproblems will be divided still further
Top-down design methods fulfil this criterion;
stepwise refinement is an example of such method
Software Engineering
Software Design
Slide 13
Software Engineering
Software Design
Slide 14
Top-down Design
In principle, top-down design involves starting
at the uppermost components in the hierarchy
and working down the hierarchy level by level.
In practice, large systems design is never
truly top-down. Some branches are designed
before others. Designers reuse experience (and
sometimes components) during the design
process.
Software Engineering
Software Design
Slide 15
Modular Composability
A method satisfies this criterion if it leads to the production
of modules that may be freely combined to produce new
systems.
Composability is directly related to the issue of reusability
Note that composability is often at odds with
decomposability; top-down design,
for example, tends to produce modules that may not be composed
in the way desired
Software Design
Slide 16
Examples
The Numerical Algorithm Group (NAG)
libraries contain a wide range of routines for
solving problems in linear algebra, differential
equations, etc.
The Unix shell provides a facility called a pipe,
written , whereby
the standard output of one program may be
redirected to the standard input of another; this
convention favours composability.
Software Engineering
Software Design
Slide 17
Modular Understandability
A design method satisfies this criterion if it
encourages the development of modules which
are easily understandable.
COUNTER EXAMPLE 1. Take a thousand lines program,
containing no procedures; its just a long list of sequential
statements. Divide it into twenty blocks, each fifty statements
long; make each block a method.
COUNTER EXAMPLE 2. Go to statements.
Software Engineering
Software Design
Slide 18
Understandability
Related to several component characteristics
Software Design
Slide 19
Modular Continuity
A method satisfies this criterion if it leads to the
production of software such that a small change in the
problem specification leads to a change in just one (or a
small number of ) modules.
EXAMPLE. Some projects enforce the rule that no
numerical or textual literal should be used in programs:
only symbolic constants should be used
COUNTER EXAMPLE. Static arrays (as opposed to
open arrays) make this criterion harder to satisfy.
Software Engineering
Software Design
Slide 20
Modular Protection
A method satisfied this criterion if it yields
architectures in which the effect of an abnormal
condition at run-time only effects one (or very few)
modules
EXAMPLE. Validating input at source prevents errors
from propagating throughout the program.
COUNTER EXAMPLE. Using int types where
subrange or short types are appropriate.
Software Engineering
Software Design
Slide 21
Software Engineering
Software Design
Slide 22
Software Design
Slide 23
Few Interfaces
This principle states that the overall number of
communication channels between modules
should be as small as possible:
Every module should communicate with as few
others as possible.
Software Design
Slide 24
Few Interfaces
Software Engineering
Software Design
Slide 25
Software Engineering
Software Design
Slide 26
Coupling
A measure of the strength of the inter-connections
between system components.
Loose coupling means component changes are
unlikely to affect other components.
Shared variables or control information exchange lead
to tight coupling.
Loose coupling can be achieved by state
decentralization (as in objects) and component
communication via parameters or message passing.
Software Engineering
Software Design
Slide 27
Tight Coupling
Module A
Module B
Module C
Module D
Shared data
area
Software Engineering
Software Design
Slide 28
Loose Coupling
Module A
As data
Module B
Module C
Bs data
Cs data
Module D
Ds data
Software Engineering
Software Design
Slide 29
Software Engineering
Software Design
Slide 30
Reusability
A major obstacle to the production of cheap quality
software is the intractability of the reusability issue.
Why isnt writing software more like producing
hardware? Why do we start from scratch every time,
coding similar problems time after time after time?
Obstacles:
Economic;
Organizational;
Psychological.
Software Engineering
Software Design
Slide 31
Stepwise Refinement
The simplest realistic design method, widely used in
practice.
Not appropriate for large-scale, distributed systems:
mainly applicable to the design of methods.
Basic idea is:
Start with a high-level spec of what a method is to achieve;
Break this down into a small number of problems (usually no
more than 10)
For each of these problems do the same;
Repeat until the sub-problems may be solved immediately.
Software Engineering
Software Design
Slide 32
Explicit Interfaces
If two modules must communicate, they must do
it so that we can see it:
If modules A and B communicate, this must be
obvious from the text of A or B or both.
Software Engineering
Software Design
Slide 33
Information Hiding
This principle states:
All information about a module, (and particularly how the
module does what it does) should be private to the module
unless it is specifically declared otherwise.
Software Design
Slide 34
Cohesion
A measure of how well a component fits
together.
A component should implement a single logical
entity or function.
Cohesion is a desirable design component
attribute as when a change has to be made, it
is localized in a single cohesive component.
Various levels of cohesion have been identified.
Software Engineering
Software Design
Slide 35
Cohesion Levels
Coincidental cohesion (weak)
Parts of a component are simply bundled together.
Software Design
Slide 36
Cohesion Levels
Communicational cohesion (medium)
All the elements of a component operate on the same input or
produce the same output.
Software Design
Slide 37
Software Design
Slide 38