Structure Chart Part 2 for A Level Computer Science by Inqilab Ruknuddin Patel

Описание к видео Structure Chart Part 2 for A Level Computer Science by Inqilab Ruknuddin Patel

12.2 Structure Chart
A Structure chart is graphical representation of the modular structure of a solution
It is an alternative approach to modular design is to choose the sub-tasks and then construct a structure chart to show the interrelations between the modules. Each box of the structure chart represents a module. Each level is a refinement of the level above.
A structure chart also shows the interface between modules, the variables. These variables are referred to as 'parameters' (a value passed between modules). A parameter supplying a value to a lower-level module is shown as a downwards pointing arrow. A parameter supplying a new value to the module at the next higher level is shown as an upward pointing arrow.
Structure charts help programmers to visualise how modules are interrelated and how they interface with each other. When looking at a larger problem this becomes even more important.
Purpose of structure chart:
Structure charts are used to demonstrate:
• Decomposition or top-down design (how a problem is broken down into smaller sub-tasks),
• Hierarchy of the program,
• Selection and repetition (loop),
• The parameters (data items being exchanged among modules),
• Modules are whether function or procedure.

Figure shows a structure chart for the Connect 4 program. It uses the following symbols:
• An arrow with a solid round end shows that the value transferred is a flag (a Boolean value).
• A double-headed arrow shows that the variable value is updated within the module
Symbol Name Meaning
Module Name
Process Each Box represents a programming module, this might be something that calculates the average of some figures, or prints out some pay slips
Data Couple Data being passed from module to module that needs to be processed.
Flag Check data sent to process to stop or start processes. For example when the End of a File that is being read is reached, or a flag to say whether data sent was in the correct format
Parameters passed by reference shows that the variable value is updated within the module

Figure shows a structure chart for a module that calculates the average of two numbers. The top-level box is the name of the module, which is refined into the three subtasks of Level 1. The input numbers (parameters Numberl and Number2) are passed into the 'Calculate Average' sub-task and then the Average parameter is passed into the 'OUTPUT
Average' sub-task. The arrows show how the parameters are passed between the modules. This parameter passing is known as the 'interface'.


Module: Section of code that perform part of the task not whole task, also known as sub-routine.
Parameter: The data items being exchanged among modules.
Pass: Exchange of parameters among modules.
Call: Executing a module
Called With: Passing parameters to a module at the time of executing it.
Return: Sending data from called module to the calling module.
Function: A module that always returns a value.
Procedure: A module that never return a value.

Комментарии

Информация по комментариям в разработке