Structure Chart

Download Report

Transcript Structure Chart

CS362
High Level Program Design Tool
Structure Chart
© 2011, Regis University
1
Structure Charts

A structure chart purpose:

Shows only WHAT tasks your program
will do (not HOW it will complete them)
2
Structure Charts

Structure charts are hierarchical diagrams

They diagram the overall program structure

They show the relationship between all the
tasks (functions) in the program

They indicate which data is shared by the
tasks (functions)
3
Creating a Structure Chart


A large program design is first broken into tasks
Tasks are repeatedly divided into even smaller subtasks
 Rectangles are used to represent tasks/subtasks
within the program

Lines are used to hierarchically connect the
tasks/sutasks

Subtasks are diagrammed below the task that they
are part of
Task
SubTask1
SubTask2
4
Creating a Structure Chart

The passing of data between tasks is shown by arrows
going up from or down to the task’s rectangle
Task
Data1
SubTask1
Data1
SubTask2

An upward arrow indicates that the data value has been set
inside the task and is being passed out for use by other tasks.

A downward arrow indicates a data value previously set in
some other task is now being passed into this task.

Data may also be passed both into a task (downward arrow),
modified, and passed back out again (upward arrow).
5
Sample Structure Chart
Given a generic program that reads some data from the
user, runs some calculations using that data, and
displays results to the user, the structure chart could
look like this:
main
data
getInput
data
result
processData
result
displayResults
6
Expanded Example
If the processData task is complicated, it may be broken
down into further sub-tasks. The structure chart could
look like this:
main
data
data
getInput
result
processData
data
data
data
convertData
result
displayResults
result
analyzeData
7
In Summary

Put starting function in a rectangle root of an upside-down tree.

Determine the main subtasks that must be performed by the
program to solve the problem.


Examine each subtask individually, and break them down into
even smaller tasks.


Put main subtasks in rectangles below the root, and draw a
connecting line from the root to each subtask.
Put subtasks in rectangles below the task that they are part
of, and draw a connecting line from task to subtask.
Repeat until the bottom tasks of the tree are very simple tasks
to complete
8