1 CS362 High Level Program Design Tool Structure Chart © 2011, Regis University
2 Structure Charts A structure chart purpose: Shows only WHAT tasks your program will do (not HOW it will complete them)
3 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)
4 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 SubTask1SubTask2
5 Creating a Structure Chart 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). Task SubTask1SubTask2 Data1 The passing of data between tasks is shown by arrows going up from or down to the task’s rectangle
6 Sample Structure Chart main getInputprocessDatadisplayResults data result data result 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:
7 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 getInputprocessDatadisplayResults data result data result convertDataanalyzeData result data
8 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. Put main subtasks in rectangles below the root, and draw a connecting line from the root to each subtask. Examine each subtask individually, and break them down into even smaller tasks. 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