Design
Software Design
the process of applying various techniques
and principles for the purpose of defining a
device, a process, or a system in sufficient
detail to permit its physical realization.
Goal:
To produce a model or representation that
will later be built
HOW
CONCEPTUAL
DESIGN
TECHNICAL
DESIGN
function
System
designers
Customers
form
System
builders
Design Document
Introduction
Problem Statement
Document
Overview
Revised
Requirements
System Models
Data
Function
Procedure
Conceptual Design
Architecture
Diagram
Description
Detailed Design
Data Design
Procedural Design
UI Design
Sources
Appendix
Architectural Design
Objective is to develop a modular
program structure and represent the
control relationships between modules
Combines program and data structure
by defining interfaces that allows data
to flow throughout the program
Holistic view of software
Data Design
The primary activity during data design is to select
logical representations of data objects identified during the
requirements definition and specification phase. The selection
process may involve algorithmic analysis of alternative structures
in order to determine the most efficient design or may simply
involve the use of a set of modules that provide the operations
upon some representation of an object.
[Wasserman]
Procedural Design
After data & program structure have
been established, becomes necessary to
specify procedural detail without
ambiguity
Design Notations
Structured programming
Graphical design notation
Tabular design notation
Program design language (PDL)
Abstract
Abstract
specifi ca
tion
specifi ca
tion
Interface
Interface
design
design
Component
Component
design
design
Data
Data
structur
e
structur
e
design
design
Algorithm
Algorithm
design
design
System
System
architectur
e
architectur
e
Software
Software
specifi ca
tion
specifi ca
tion
Interface
Interface
specifi ca
tion
specifi ca
tion
Component
Component
specifi ca
tion
specifi ca
tion
Data
Data
structur
e
structur
e
specifi ca
tion
specifi ca
tion
Algorithm
Algorithm
specifi ca
tion
specifi ca
tion
Design pr
oducts
Design pr
oducts
Characteristics of Good
Design
Component independence
High cohesion
Low coupling
No dependencies
Range of Coupling
Content
High Coupling
Common
Control
Loose
Stamp
Data
Uncoupled
Low
Content coupling
Definition: One component references
contents of another
Example:
Component directly modifies anothers data
Component refers to local data of another
component in terms of numerical
displacement
Component modifies anothers code, e.g.,
jumps into the middle of a routine
Common Coupling
Definition: Two components share data
Global data structures
Common blocks
Control Coupling
Definition: Component passes control
parameters to coupled components.
May be either good or bad,
depending on situation.
Bad when component must be aware of
internal structure and logic of another
module
Good if parameters allow factoring and
reuse of functionality
Stamp Coupling
Definition: Component passes a data
structure to another component that does
not have access to the entire structure.
Requires second component to know how
to manipulate the data structure (e.g.,
needs to know about implementation)
May be necessary due to efficiency
factors: this is a choice made by insightful
designer, not lazy programmer.
Data Coupling
Definition: Two components are data
coupled if there are homogeneous data
items.
Every argument is simple argument or
data structure in which all elements are
used
Good, if it can be achieved.
Easy to write contracts for this and modify
component independently.
Cohesion
The degree to which all elements of a
component are directed towards a single
task and all elements directed towards
that task are contained in a single
component.
Internal glue with which component is
constructed
All elements of component are directed toward
and essential for performing the same task
High is good
Range of Cohesion
Functional
Informational
High Cohesion
Sequential
Communicational
Procedural
Temporal
Logical
Low
Coincidental Cohesion
Definition: Parts of the
component are only related by
their location in source code
Elements needed to achieve some
functionality are scattered
throughout the system.
Accidental
Worst form
Logical Cohesion
Definition: Elements of component
are related logically and not
functionally.
Several logically related elements are
in the same component and one of
the elements is selected by the client
component.
Temporal Cohesion
Definition: Elements of a component
are related by timing.
Difficult to change because you may
have to look at numerous
components when a change in a data
structure is made.
Increases chances of regression fault
Component unlikely to be reusable.
Procedural Cohesion
Definition: Elements of a component
are related only to ensure a
particular order of execution.
Actions are still weakly connected
and unlikely to be reusable
Communicational Cohesion
Definition: Module performs a series
of actions related by a sequence of
steps to be followed by the product
and all actions are performed on the
same data
Sequential Cohesion
The output of one component is the
input to another.
Occurs naturally in functional
programming languages
Good situation
Informational Cohesion
Definition: Module performs a number of
actions, each with its own entry point, with
independent code for each action, all
performed on the same data.
Different from logical cohesion
Each piece of code has single entry and single
exit
In logical cohesion, actions of module
intertwined
Functional Cohesion
Definition: Every essential element to
a single computation is contained in
the component.
Every element in the component is
essential to the computation.
Ideal situation.
Structured Programming
structured programming: A technique
for organizing and coding computer
programs in which a hierarchy of modules
is used, each having a single entry and a
single exit point, and in which control is
passed downward through the structure
without unconditional branches to higher
levels of the structure. Three types of
control flow are used: sequential, test,
and iteration.
Advantages of Structured
Programming
Easy to write
Reusability
Easy to debug
Easy to Understand
Easy to Change
Structured programming
Top-down vs bottom-up
Both are useful as a means to understand the relations between
high-level and low-level views of a program
Top-down
Code high level parts using stubs with assumed functionality for
low-level dependencies
Iteratively descend to lower-level modules
Bottom-up
Code and test each low-level component
Need test harness so that low-level can be tested in its correct context
Integrate components
Coding style