Sei sulla pagina 1di 66

An Introduction to Software

Engineering
Spring Semester, 2008
Copyright Reserved
Building Design Model

Review of Last Lecture (1/3)


„ Software design bridges the requirement and
programming
„ Software design should consider the software
requirements and constraints such as cost, schedule.
„ Software design covers
– Architecture design
– Data design
– Component design
– Interface design
– Deployment design

©Copyright Xinjun Mao 2


Building Design Model

Review of Last Lecture (2/3)


„ Quality should be considered when designing
– The designed software not only should satisfy the
customers’ requirements, but also should have high
quality
– Quality of software design should be assessed in the
process of software design
– Formal Technical Review (FTR) attempts to find
the errors, omissions, defects in SDS

©Copyright Xinjun Mao 3


Building Design Model

Review of Last Lecture (3/3)


„ Software design should respect design principles
– Abstract, Modularity, High cohesion, Low Coupling,
Information Hiding, etc.
„ Result of software design should be specified by
various languages and tools
– Hierarchy diagram, HIPO diagram, Flow diagram, etc.
„ Result of software design should be written as a
document and be reviewed
– SDS: Software Design Specification

©Copyright Xinjun Mao 4


Building Design Model

Today’s Topic
„ Building Architecture Design Model
„ Data Flow Oriented Design Technology

Requirements
Requirements Mapping Designs
Designs
(SRS)
(SRS) (SDS)
(SDS)

©Copyright Xinjun Mao 5


Chapter 10.6 in Textbook

Building Architecture Design


Model
Prof. Mao Xinjun
xjmao@nudt.edu.cn
Tel: 0731-4573649
Department of Computer Science and Technology,
National University of Defense Technology
Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 7


Building Design Model

From Analysis to Design (1/2)

Complete and
Design Related
Requirement Technology Software
Requirement Software
AnalysisModels
Analysis Models DesignModels
Design Models

SRS, What SDS, How

©Copyright Xinjun Mao 8


Building Design Model

From Analysis to Design (2/2)


„ Data Flow Oriented Design Technology
– One kind of structure design technology
– Presented by Myers and Yourdon
– Approach, process, and strategy

DataFlow
Data Flow Software
Software
Requirement
Requirement Data Flow Architecture
Architecture
Models
Models Oriented Design DesignModels
Design Models
Technology
©Copyright Xinjun Mao 9
Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 10


Building Design Model

Two Kinds of Data Flows


„ Transform Flow (变换流)
„ Transaction Flow (事务流)

©Copyright Xinjun Mao 11


Building Design Model

Transform Flow (1/2)


„ Information must enter and exit software in an
“external world” form, and such externalized data must
be converted into an internal form for processing
„ Three parts of transform flow
– Incoming flow: Information enters the system along paths
that transform external data into internal data
– Transform center: Internal data is processed
– Outgoing flow: Internal data are transformed into external
data

©Copyright Xinjun Mao 12


Building Design Model

Transform Flow (2/2)


Incoming
External Flow
Outgoing
Transform Flow
Center

Internal

Time

©Copyright Xinjun Mao 13


Building Design Model

Sample of Transform Flow

©Copyright Xinjun Mao 14


Building Design Model

Transaction Flow (1/2)


„ Information flow is characterized by a single data item
that triggers other data flow along one of many paths
„ Four parts of transaction flow
– Transaction: input data to trigger processing
– Transaction flow: path that converts the external data into a
transaction
– Transaction Center: the hub of information flow from which
many action paths emanate
– Action paths

©Copyright Xinjun Mao 15


Building Design Model

Transaction Flow (2/2)


Transaction Transaction
Flow

Action
Paths

Transaction
Center

©Copyright Xinjun Mao 16


Building Design Model

Sample of Transaction Flow


Transaction
Flow

Transaction

Transaction
©Copyright Xinjun Mao 17
Center
Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 18


Building Design Model

Transform Mapping
„ Mapping the transform data flow diagram into
software architecture design model
– Input: transform data flow diagram
– Output: software architecture

Transform Data Transform Software


Flow Mapping Architecture

©Copyright Xinjun Mao 19


Building Design Model

Process of Transform Mapping


Step1:Review
Step1: Reviewthe
thefundamental
fundamentalsystem
systemmodel
model
Step2:Review
Step2: Reviewand
andrefine
refinedata
dataflow
flowdiagram
diagramfor
forthe
thesoftware
software
Step3:Determine
Step3: Determinethe
thetype
typeof
ofdata
dataflow
flow

Transform Data Flow


Step4:Isolate
Step4: Isolatethe
theflow
flowboundaries
boundaries
Step5:Perform
Step5: “first-levelfactoring”
Perform“first-level factoring”
Step6:Perform
Step6: “second-levelfactoring”
Perform“second-level factoring”
Step7:Refine
Step7: Refinethe
thesoftware
softwarearchitecture
architecture
©Copyright Xinjun Mao 20
Building Design Model

Step1. Review the Fundamental


System Model
„ What is fundamental system model?
– Top-level or 0-level data flow diagram
„ Why reviewing the fundamental system model?
– To evaluate the SRS in order to guarantee that the
system model conforms to the real system
Control panel
display

Control panle
Display info.
User commands and data

SafeHome
Alarm type Alarm
software

Sensor status
Telephone number tones
Sensors

©Copyright Xinjun Mao Telephone 21


line
Building Design Model

Step2: Review and Refine Data


Flow Diagram for the Software
„ Why review and refine data flow diagram?
– DFD is correct
– Produce greater detail
– Each transform in the data flow diagram exhibits
relatively high cohesion that can be implemented as
a component in software

©Copyright Xinjun Mao 22


Building Design Model

Level-0 Data Flow Diagram

Control panel
display

Control panle
Display info.
User commands and data

SafeHome
Alarm type Alarm
software

Sensor status
Telephone number tones
Sensors

Telephone
line

©Copyright Xinjun Mao 23


Building Design Model

Level-1 Data Flow Diagram

©Copyright Xinjun Mao 24


Building Design Model

Level-2 Data Flow Diagram

©Copyright Xinjun Mao 25


Building Design Model

Level-3 Data Flow Diagram

©Copyright Xinjun Mao 26


Building Design Model

Step3. Determine the Type of Data


Flow
„ Transform flow or transaction flow
„ Different type of data flow corresponds to
different mapping approach

©Copyright Xinjun Mao 27


Building Design Model

Step 4. Isolate Flow Boundaries


Outgoing
„ Incoming flow External
Incoming
Flow Flow
„ Transform center Transform
Center
„ Outgoing flow
Internal

Time

Different designers may select slightly different


points in flow as boundary location, and therefore
have different design
©Copyright Xinjun Mao 28
Building Design Model

Sample of Isolating Boundary (1/2)

Incoming Flow Transform Center Outgoing Flow

A B F

E H I J

C D G

©Copyright Xinjun Mao 29


Building Design Model

Sample of Isolating Boundary (2/2)

©Copyright Xinjun Mao 30


Building Design Model

Step5. Perform First-level Factoring


„ Generating a 3-hiarchy top-down distribution of
control structure
– Top-level components perform decision-making
– Low-level components perform most input, computation,
and output work
– Middle-level components perform some control work
„ The generated software structure can be specified by
hierarchy diagram or structure diagram

©Copyright Xinjun Mao 31


Building Design Model

Step5. Perform “First-level” Factoring


Main High level
Program
Controller

Input Processing Output Middle


Controller Controller Controller level

Low level
©Copyright Xinjun Mao 32
Building Design Model

Sample of “First-level” Factoring


main
program
controller

input processing output


controller controller controller

©Copyright Xinjun Mao 33


Building Design Model

Step6. Perform “Second-level”


Factoring
„ Mapping individual transforms of a DFD into a
appropriate modules with the architecture
„ Approach
– Beginning at the transform center boundary and
moving outward along incoming and then outgoing
paths, transforms are mapped into sub-ordinate
levels of the software architecture, transforms are
mapped into sub-ordinate levels of the software
structure
©Copyright Xinjun Mao 34
In c o m in g F lo w Tr a n sfo r m C e n te r O u tg o in g F lo w

A B F

E H I J

C D G

M a in C o n tro lle r

In p u t C o n tro lle r P ro ce ssin g C o n tro lle r O u tp u t C o n tro lle r

B D E I

A C F G J

H
Building Design Model

Sample of “Second-level” Factoring


Main Control

Input Controller Processing Output


Controller Controller

Get response Establish alarm Format Generate Establish phone


info. conditions display alarm signal commecntion

Read sensor Select phone Generate Generate pulse


number display to line

©Copyright Xinjun Mao 36


Building Design Model

Step7. Refine the Software


Architecture
„ Applying principles of “modular”
– Components are exploded or imploded to produce
sensible factoring, good cohesion, minimal
coupling.
– A good structure can be implemented without any
difficulty, tested without confusion, and maintained
without grief

©Copyright Xinjun Mao 37


In c o m in g F lo w Tr a n sfo r m C e n te r O u tg o in g F lo w

A B F

E H I J

C D G

M a in C o n tro lle r

In p u t C o n tro lle r P ro ce ssin g C o n tro lle r O u tp u t C o n tro lle r

B D E I

A C F G J

H
Incoming Flow Transform Center Outgoing Flow

A B F

E H I J

C D G

Main Controller

Input Controller Processing Controller I

B D E J

A C F G

H
Building Design Model

Sample of Refinement (1/2)

Main Control

Input Controller Processing Output


Controller Controller

Get response Establish alarm Format Generate Establish phone


info. conditions display alarm signal commecntion

Read sensor Select phone Generate Generate pulse


number display to line

©Copyright Xinjun Mao 40


Building Design Model

Sample of Refinement (2/2)

Main Control

Get response Establish alarm Output


info. conditions Controller

Read sensor Select phone Format Generate Establish phone


number display alarm signal commecntion

Generate Generate pulse


display to line

©Copyright Xinjun Mao 41


Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 42


Building Design Model

Transaction Mapping
„ Mapping the transaction data flow diagram into
software architecture design model
– Input: transaction data flow diagram
– Output: software architecture

Transaction Data Transaction Software


Flow Mapping Architecture

©Copyright Xinjun Mao 43


Building Design Model

Process of Transform Mapping


Step1:Review
Step1: Reviewthe
thefundamental
fundamentalsystem
systemmodel
model
Step2:Review
Step2: Reviewand
andrefine
refinedata
dataflow
flowdiagram
diagramfor
forthe
thesoftware
software
Step3:Determine
Step3: Determinethe
thetype
typeof
ofdata
dataflow
flow
Transaction Data Flow
Step4:Determine
Step4: Determinethethetransaction
transactioncenter
centerand
andthe
theflow
flow
characteristicsalong
characteristics alongeach
eachofofthe
theaction
actionpaths
paths
Step5:Map
Step5: MapthetheDFD
DFDin inaaprogram
programstructure
structureto
totransaction
transaction
processing
processing
Step6:Factor
Step6: Factorand
andrefine
refinethe
thetransaction
transactionstructure
structureand
andthe
the
structureof
structure ofthe
theaction
actionpath
path
©Copyright Xinjun Mao
Step7:Refine
Refinethe
thesoftware
softwarearchitecture
architecture 44
Step7:
Building Design Model

Sample of Transaction DFD (1/2)


transaction flow

action path
T

©Copyright Xinjun Mao 45


Building Design Model

Sample of Transaction DFD (2/2)


Transaction center

fixture setting fixture


servos

commands
operator process
report display
operator
commands screen

robot control

robot
control
software
Transaction assembly
record
in reality, other
commands
would also be shown

©Copyright Xinjun Mao 46


Building Design Model

Step 4.Identify the Transaction Center


and Action Paths
„ Three parts of transaction DFD
– Input flow
– Transaction center
– Action path
„ Evaluate the flow characteristics of each action
path
– Transaction flow or transform flow

©Copyright Xinjun Mao 47


Building Design Model

Step5. Map DFD in Program


Structure
A Tra n sa ctio n C o n tro l

R ecep tio n
In p u t C o n tro ller C D isp a tch er
B P a th

C1 Cn
C

P A ctio n P a th
E
Q

D
R

©Copyright Xinjun Mao 48


Building Design Model

Sample (1/3)

©Copyright Xinjun Mao 49


Building Design Model

Sample (2/3)

©Copyright Xinjun Mao 50


Building Design Model

Sample (3/3)

User interaction executive

Read user Invoke command


command processing

System Activate/deact Password


configuration ivate system processing
controller
©Copyright Xinjun Mao controller 51
Building Design Model

Step6. Factor and Refine the Transaction


Structure and Each Action Path
A Transaction Control

Reception
Input Controller C Dispatcher
B Path

C1 Cn
B
C

P
A P Q S
E
Q

R
D
R

©Copyright Xinjun Mao 52


Building Design Model

Step7. Refine the Software


Architecture (1/2)
A Transaction Control

Reception
Input Controller C Dispatcher
Path
B

C1 Cn
B
C

P
A P Q S
E
Q

R
D
R

S
©Copyright Xinjun Mao 53
Building Design Model

Step7. Refine the Software


Architecture (2/2)
A Transaction Control

Reception
B C Dispatcher
B Path

C1 Cn
C A

P
P Q S
E
Q

R
D
R

S
©Copyright Xinjun Mao 54
Building Design Model

Sample of Refinement (1/3)

©Copyright Xinjun Mao 55


Building Design Model

Sample of Refinement (2/3)


User interaction
executive

Input Invoke command


controller processing

Read user System Activate/deact Password


command configuration ivate system processing
controller controller

Read system Build Read Compare Password


data configuration password password output
file controller

Display
msg&status Produce
invalid
message

©Copyright Xinjun Mao 56


Building Design Model

Sample of Refinement (3/3)


User interaction
executive

Read user Invoke command


command processing

System Activate/deact Password


configuration ivate system processing
controller controller

Read system Build Read Compare Password


data configuration password password output
file controller

Display
msg&status Produce
invalid
message
©Copyright Xinjun Mao 57
Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 58


Building Design Model

Heuristics Strategy (1/2)


„ Adjust software architecture
to improve modularity
– Decompose modules
– Combine modules

©Copyright Xinjun Mao 59


Building Design Model

Heuristics Strategy (2/2)


„ Decrease the complexity of modules and
redundancy
– Interface of module should be simple and consistent
with its function
– E.g., Sort(Data; Number) ----ÆSort(Data)
„ The function of module should be predictable

©Copyright Xinjun Mao 60


Building Design Model

Agenda
„ From Analysis to Design
„ Two Kinds of Data Flows
„ Transform Mapping
„ Transaction Mapping
„ Refine the Architecture Design
„ Summary

©Copyright Xinjun Mao 61


Building Design Model

Summary (1/2)
„ Requirements (DFD) Î Architecture Design
– Systematic approaches should be presented to guide the
software design
– To guarantee the completeness and correctness of software
design
„ Data flow oriented design technology
– Provide methods and steps to map the requirements model
into design models
– DFD diagrams Î Hierarchy diagrams
– Architecture design
©Copyright Xinjun Mao 62
Building Design Model

Summary (2/2)
„ Two kinds of DFD
– Transform DFD
– Transaction DFD
„ Two kinds of approaches
– Transform mapping
– Transaction mapping
„ Refinement strategy
– High quality software design
©Copyright Xinjun Mao 63
Building Design Model

Assignment
„ See assignment3 (doc)

©Copyright Xinjun Mao 64


Building Design Model

Next Lecture
„ Software testing
„ Chapter 13 and 14 in
Textbook

©Copyright Xinjun Mao 65


Building Design Model

Introduction to Software Engineering

Q&A

Practice, Practice and Practice

©Copyright Xinjun Mao 66

Potrebbero piacerti anche