Documente Academic
Documente Profesional
Documente Cultură
Iteration
Performing process blocks more than once An asterisk (i.e. *) in the top right hand corner of a rectangle representing a process block indicates that it is iterated
Selection
Performing process blocks selectively based on identified criteria A circle (i.e. O or 0) in the top right hand corner of a rectangle representing a process block indicates that it is performed based on identified selection criteria
Selection
D
Else
Iteration
Condition
Condition
O
H *
Structured Program Design assumes a read-ahead approach to the handling of file records and database sets This means that you must :Attempt to read the first record in the file or set before performing the processing for those records Attempt to read the next record in the file or set as the last action in the processing for those records
11
21
22
23
31
111
112
221
222
2211
S3
S2
B1
B11 *
B12
B13
B14
B15
B11 *
B12
B13
Else
Condition Condition
WRONG !!
B131
B132
B133
RIGHT !!
Methodology
There are two methods of developing the diagram :Bottom Up (Jackson Structure Program Design) Method
Is based on an analysis of the input and output data structures and identification of the tasks that have to be performed to get from input to output Tasks are then grouped together in logically related units These units are then grouped together higher level units and this process is repeated until all units are grouped under one top level until (i.e. the program)
Methodology (1)
Example of Bottom-Up approach
Program function is to update file B with information from file A (NB Both files are sorted into the same sequence and every record on file A has a corresponding record on file B and vice versa) Data related actions
Access data on A Access data on B Update data on B using data from A
Methodology (1)
Group tasks together into logically related units
Open file A / Open file B Read file A / Read file B Move data from current A to current B / Write current B back to file Read next file A / Read next file B At end close file A / close file B
Process data
*
Read A Read B
Methodology (1)
Note that when drawing the diagram this methodology does not allow a component block to own blocks of more than one type Therefore in the diagram above we have to introduce component block Process data to own process block Update data instead of having this block owned directly by Program Also note that process block Read A / Read B is repeated under process blocks Access data and Update data this means that this process block can be taken out as a common subroutine within the program
Methodology (2)
Example of Top-Down approach
Program function is to update file B with information from file A (NB Both files are sorted into the same sequence and every record on file A has a corresponding record on file B and vice versa) Identify Level 2 functions (NB Level 1 is the program)
Initial routine Main program routines performed until end of files Closing routines
Methodology (2)
Identify Level 3 functions
Initial routine
Open files Read files
Closing routines
Close files
Methodology (2)
Identify Level 4 functions
Initial routine
Open files Open file A Open file B Read files Read file A Read file B
Closing routines
Close files Close file A Close file B
Methodology (2)
Draw Diagram
Program
Read A Read B
Ideally if the decomposition has been done correctly the bottom layer of boxes in each branch should contain no PERFORM or IF statements Note that conditions are identified as the functions are being decomposed
Methodology (2)
Also note that process block Read A / Read B is repeated under process blocks Access data and Update data this means that this process block can be taken out as a common subroutine within the program Also note that generally when drawing a Top-down structure diagram the top two level will almost always be the same as shown in the diagram below
Program
Condition(s)
Start Processes Main Processes
Finish Processes
Advantages
Non-Inspirational
The use of structured program design does not rely on insists, invention or creativity
Rational
It is based on reasonable principles well developed and well defined
Teachable
Being collections of well defined steps it is possible to explain and show how these methods are applied and how they work
Consistent
Given a single problem for analysis different programmers or systems analysts will generally come up with the same program design
Advantages
Simple
These methods do not involve over complex rules or cumbersome procedures
Universal
By using these methods program specifications and designs are produced that can be implemented in any language
Disadvantages (?)
Mechanical not Intuitive
Because these methods are largely mechanical and standardised they do not allow systems analysts or programmers to be intuitive
Increases Regimentation
Does not allow systems analysts and programmers to use their imagination and come up with radical and innovative designs
Disadvantages
Method 1
Because this method is based on the input and/or output data structures it means that these must be very clearly defined before the systems analysts and programmers can start work - no data structures means no place to start Any changes to the data structure involved may require major rework of the specification and program design
Method 2
Because this method is based on the program functionality it means that this must be very clearly defined and identified before the systems analysts and programmers can start work Any changes to the program functionality may require major rework of the specification and program design