Professional Documents
Culture Documents
SE-LEC-UOG-12 - Design Concepts and Principle
SE-LEC-UOG-12 - Design Concepts and Principle
What is Design
Design is a meaningful engineering representation of
something that is to be built
Problem
15
There are four major areas of design
1. Data
2. Architecture
3. Interfaces
4. Components
Analysis to Design
interface
Data Dictionary
design
architectural
State-Transition design
Diagram
data
Control Specification (CSPEC) design
Data abstraction
named collection of data that describes a data
object.
Procedural Abstraction
open
details of enter
algorithm
manufacturer
model number
type
swing direction
inserts
type
weight
opening mechanism
Requirements
Modular Design
easier to build, easier to change, easier to fix ...
Divide and Conquer
Software Architecture embodies modularity
Software is divided into separately named and addressable
components often called modules, that are integrated to
satisfy problem requirements
Modularity: Trade-offs
What is the "right" number of modules
for a specific software design?
3. Software Architecture
Simply stated : “Software Architecture is an arrangement
of components”
It is at a high-enough level of abstraction that the system
can be viewed as a whole
Software Architecture is a sketchy map of the system. It
describes
The components of the system
and the connectors between those components describe the
communication
In the implementation phase, components are refined into
actual components, e.g. classes and objects
and the connectors are usually implemented as interfaces
Contd…!!!
It is a high level abstraction of the system
The structure must support the functionality required of the
system
The structure or Architecture must conform to the system
qualities (non-functional requirements)
At the Architecture level, all implementation detail is
hidden
o Fan-In
How many modules directly control a given module
o Fan-Out
How many modules are directly controlled by another
module
EXECUTIVE
EXECUTIVE
Fan out
Fan in
Breadth
4. Structural Partitioning
Horizontal Partitioning
Defines separate branches of the modular hierarchy for each
major program function
o Change tend to be less complex
o Extensions are easier to accomplish without side effects
o On the negative side, it causes more data to be passed across
module interfaces
Vertical Partitioning
Suggests that control (decision making) and work should be
distributed top-down in the program structure
o A change in a control module will have a higher probability of
propagating side effects to modules that are subordinate to it
5. Data Structure
Data Structure is a representation of the logical
relationship among individual elements of data
It dictates
• The organization of data
• Methods of Access
• Degree of Associativity
• Processing alternatives for information
module • algorithm
controlled
interface • data structure
clients "secret"
28
Functional Independence
GOAL
Low Coupling
High Cohesion
Cohesion
Extension of information hiding
Performs a single task within a software
procedure, requiring little interaction
with procedures being performed in
other parts of a program.
Cohesion
Internal glue with which component is
constructed
All elements of component are directed toward
and essential for performing the same task
So ftwa re De sig n
Be st Func tio na l
Se q ue ntia l
Co m m unic a tio na l
Pro c e d ura l
Te m p o ra l
Lo g ic a l
Wo rst Co inc id e nta l
30
Range of Cohesion
High Cohesion
Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental Low
Functional Cohesion
Contains elements that all contribute to the execution of one
and only one problem-related task.
Example
• Compute cosine of angle
• Verify alphabetic syntax
• Read transaction record
• Determine customer mortgage repayment
• Compute point of impact of missile
• Calculate net employee salary
• Assign seat to airline customer
Each of these modules has a strong, single-minded purpose.
Sequential Cohesion
Elements are involved in activities such that output
data from one activity serves as input data to the next.
Example
• Clean car body
• Fill in holes in car
• Sand car body
• Apply primer
This group of four activities cannot be summed up as a
single function
The output from one activity serves as input to the
next
Communicational Cohesion
Elements contribute to activities that use the
same input or output data.
Example
• Find title of book
• Find price of book
• Find publisher of book
• Find author of book
They all work on the same input data, the
book
Procedural Cohesion
Elements are involved in different and possibly unrelated
activities in which control flows from each activity to the
next.
Example
• Clean utensils from previous meal
• Prepare turkey for roasting
• Make phone call
• Take shower
• Chop vegetables
• Set table
They are related by order of execution rather than by any
single problem-related function.
Temporal Cohesion
Elements are involved in activities that are
related in time.
Example
• PUT OUT MILK BOTTLES
• PUT OUT CAT
• TURN OFF TV
• BRUSH TEETH
These activities are unrelated to one another
except that they’re carried out at a particular
time. They’re all part of an end-of-day routine
Logical Cohesion
Elements contribute to activities of the same
general category in which the activity or activities to
be executed are selected from outside the module
Example
• Go by car
• Go by train
• Go by boat
• Go by plane
Contains a number of activities of the same general
kind.
Coincidental Cohesion
Elements contribute to activities with no meaningful
relationship to one another
Example
• Fix car
• Bake cake
• Walk dog
• Fill out astronaut-application form
• Have a glass of juice
• Get out of bed
• Go to the movies
Activities are related neither by flow of data nor by flow of
control, nor even part of same category.
Examples of Cohesion-1
Function A Function A Time t0
Function Function
B C logic Function A’ Time t0 + X
Function Function
D E Function A’’
Time t0 + 2X
Coincidental Logical Temporal
Parts unrelated Similar functions Related by time
Function A
Function B
Function C
Procedural
Related by order of functions
Examples of Cohesion-2
Function A
Function A
Function B
Function B
Function C
Function C
Sequential
Communicational Output of one is input to another
Access same data
Function A part 1
Function A part 2
Function A part 3
Functional
Sequential with complete, related functions
Coupling
A measure of interconnection among
modules in a software structure.
Depends upon
Interface complexity between modules
Point at which entry or reference is made
to a module
What data pass across the interface
S
o
f
t
w
a
r
eD
e
s
i
g
n
t N
B
e
s o
d
i
r
e
c
t
D
a
t
a
S
t
a
m
p
C
o
n
t
r
o
l
E
x
t
e
r
n
a
l
C
o
m
m
o
n
tC
W
o
r
s o
n
t
e
n
t
3
2
Coupling
Degree of dependence among components.
Common
External
Control
Loose
Stamp
Data
Uncoupled Low
Content Coupling : (worst) When a module uses/alters data in
another module
Common Coupling : 2 modules communicating via global data
External Coupling : Modules are tied to an environment
external to the software
Control Coupling : 2 modules communicating with a control
flag
Stamp Coupling : Communicating via a data structure passed
as a parameter. The data structure holds more information than
the recipient needs.
Data Coupling : (best) Communicating via parameter passing.
The parameters passed are only those that the recipient needs.
No data coupling : independent modules.
Summary
COHESION COUPLING