8/7/2019 lec-3-functional-design
1/23
8/7/2019 lec-3-functional-design
2/23
Andrew IrelandSoftware Design F28SD2
Outline
Motivations
Data flow
Structuring
Detailed design
8/7/2019 lec-3-functional-design
3/23
Andrew IrelandSoftware Design F28SD2
Motivations
Many significant software systems fall into this
classification, e.g. transaction processing
Many legacy applications were developed usingfunction-oriented design
8/7/2019 lec-3-functional-design
4/23
8/7/2019 lec-3-functional-design
5/23
Andrew IrelandSoftware Design F28SD2
Function-oriented Activities
Data flow design:
Model data flow through the system as a set of
data flow diagrams
Structural decomposition: Model the functionality of the system as a
hierarchy of sub-functions via the structure chart
notation
Detailed design: Provide detailed data and functional descriptions,
typically supported by the notion of a data
dictionary
8/7/2019 lec-3-functional-design
6/23
8/7/2019 lec-3-functional-design
7/23
8/7/2019 lec-3-functional-design
8/23
Andrew IrelandSoftware Design F28SD2
Example: Regression TestingTesting that code modifications have not regressed the
correctness of the system as a whole:
Also as a consequence of the introduction of new bugs,
program maintenance requires far more system testing
per statement written than any other programming.
Theoretically, after each fix one must run the entire batch
of test cases previously run against the system, to
ensure that it has not been damaged in an obscure way.
In practice, such regression testing must indeed
approximate this theoretical idea, and it is very costly."
Fred Brooks, The Mythical Man Month (p 122)
8/7/2019 lec-3-functional-design
9/23
8/7/2019 lec-3-functional-design
10/23
Andrew IrelandSoftware Design F28SD2
DFD ExampleSource
code db
Test case
db
Expectedresults db
Run tests Compare
Gen Log
Gen
reports
Gen
reports
Gen
certifs
Validate
Regression
test db
and
or
s_file
t_file
e_file
a_resr_res
r_res
idid
l_file
r_file
c_file
report
certif
Data flow
8/7/2019 lec-3-functional-design
11/23
Andrew IrelandSoftware Design F28SD2
Exercise: Wanted PersonsConsider the following system requirements:
1. A user provides facial features based upon crime reports
2. If valid, then the feature list is used to retrieve a list of relevant
feature templates from a database. If the feature list is not valid
then an error message is sent to the user
3. The feature template list is used to search for matching offender
imagines which are stored within an offender records database
4. Any records for offenders already in prison are then pruned
5. From pruned list, a suspect list is dispatched to the user, while the
corresponding records are sent to a wanted persons database
Exercise: construct a DFD for the requirements above
8/7/2019 lec-3-functional-design
12/23
Andrew IrelandSoftware Design F28SD2
Structural Decomposition
For a given DFD there will exist choices as to
how it is implemented
The structure chart notation provides a means of
adding more structure to the design Each function (or procedure) is represented as a
rectangle
A high-level function is represented as a
hierarchy of sub-functions
Links between sub-functions are labelled with
input/output data, i.e. parameters or shareddata
8/7/2019 lec-3-functional-design
13/23
Andrew IrelandSoftware Design F28SD2
Structural Decomposition
A
y
A
y
x x
A
x y
A
x x
input output transform Co-ordinate
8/7/2019 lec-3-functional-design
14/23
Andrew IrelandSoftware Design F28SD2
Structural Decomposition Note that a structure chart shows the relationship
between sub-functions, but not the order in
which they are invoked
Typically a series of structure charts aredeveloped for a given DFD incrementally
expanding level by level, e.g.
A
B C
A
B C
D E F
x
x
x
z
v
u
r
s
t
z
8/7/2019 lec-3-functional-design
15/23
Andrew IrelandSoftware Design F28SD2
Structural DecompositionA
B C D
E F G H
K
I J
input outputprocess
8/7/2019 lec-3-functional-design
16/23
Andrew IrelandSoftware Design F28SD2
Structural DecompositionA
B C D
E F G H
K
I J
decision
making
data
processing
8/7/2019 lec-3-functional-design
17/23
Andrew IrelandSoftware Design F28SD2
Structure Chart: FirstRegression
tester
Initialize ReportTest
Source
code
Test
cases
Expected
results
Source
code id
Regression
results: regression log
defect report certificate
id
id
res
res
8/7/2019 lec-3-functional-design
18/23
Andrew IrelandSoftware Design F28SD2
Structure Chart: SecondRegression
tester
Initialize ReportTest
Sourcecode
Testcases
Expectedresults
Regression
log
id
idid
Validate Run tests Compare
id
res
Logger Generator
ida_res
r_res
r_res
r_res r_res
Defect
report
Certificate
r_res
8/7/2019 lec-3-functional-design
19/23
Andrew IrelandSoftware Design F28SD2
Structure Chart: ThirdRegression
tester
Initialize ReportTest
Sourcecode db
Testcase db
Regression
test db
id
idid
Validate Run tests Compare
id
res
Logger Generator
Gencert
Genreport
ida_res
r_res
r_res
r_res r_res
r_file c_file
Expectedresults db
report cert
l_files_file t_file e_file
r_res
8/7/2019 lec-3-functional-design
20/23
Andrew IrelandSoftware Design F28SD2
Detailed Design
Detailed design involves getting inside the
functional blocks represented with the structure
chart notation
At this level, Process Description Languages(PDL), i.e. pseudo code
A useful intermediate representation is a Data
Dictionary (DD) a structured, but informal,
recordofdata items and functional
DDs are useful to designers, programmers as
well as during maintenance
8/7/2019 lec-3-functional-design
21/23
Andrew IrelandSoftware Design F28SD2
Example: Data DictionaryEntity Type Description
id string Name of the source code base under test
res boolean The result of validating the name of the source code
base providedby the user
r_res vector The regression test results, i.e. the actual results vs
expectedresults
a_res vector The actual results obtainedby executing the code
base against the regression tests
test procedure Input: name of source code baseFunction: co-ordinates the execution of the regression
tests and the comparison with the expected results
Output: results of regression testing
8/7/2019 lec-3-functional-design
22/23
Andrew IrelandSoftware Design F28SD2
Sequential vs Concurrent
Note that no explicit reference has been made as
to how a design is implemented, i.e. sequential vs
concurrent
DFDs in particular do not impose a control
paradigm
A DFD representation of a function could be
implemented as a: sequence of sub-function invocations or
set of communicating processes
8/7/2019 lec-3-functional-design
23/23