A-Level Computer Science / Unit 12: Software Design, Testing and Evolution

12.2.2 Parameters, Interfaces and Control in Structure Charts

πŸ”’ Lesson slides are available to signed-in users. Sign in

12.2.2 Parameters, Interfaces and Control in Structure Charts

A structure chart does more than show how a program is divided into modules. It can also show the information passed between those modules and indicate when a module is selected or repeated.

This section adds parameter and control notation to the hierarchical designs introduced in the previous section. The resulting chart provides a more precise plan for the procedures and functions that may later appear in pseudocode.

By the end of this section, you should be able to:

  • Explain the purpose of a module interface.
  • Identify parameters supplied to and returned from modules.
  • Distinguish data parameters from control information.
  • Interpret Boolean flags and updated-value notation.
  • Explain how selection and repetition are represented.
  • Add suitable interface and control information to a structure chart.

From Module Hierarchy to Module Communication

Decomposition identifies the modules needed by a solution. The next design question is how those modules obtain the information required to perform their tasks.

Consider a module called CheckLoanEligibility. The name tells us its responsibility, but it does not tell us:

  • which member is requesting the loan;
  • which item has been selected;
  • how many days the item is needed;
  • what decision the module produces.

Parameter labels and arrows make these relationships visible.

A complete modular design should show both what each module does and what information crosses its interface.
Common misconception: Connecting two module boxes does not fully describe their relationship. The chart should also identify important values passed across the connection.

Parameters in a Structure Chart

Parameter: a named value supplied to a module or produced by a module as part of its interface.

Parameters allow a module to perform a general task using values provided by another part of the program. For example:

CheckLoanEligibility
    receives: MemberID, ItemCode, LoanDays
    produces: LoanAllowed, RejectionReason

The eligibility module does not need to collect the values itself. Its responsibility is to use the supplied values to make a decision.

Parameter Example value Why the module needs it
MemberID "M482" To locate the member's loan status
ItemCode "DRL-07" To identify the requested equipment
LoanDays 5 To check the requested duration
LoanAllowed TRUE To communicate the result to the calling module

Parameters and arguments

In a structure chart, a label normally identifies a parameter in the planned interface. When pseudocode calls the module, the actual value or expression supplied is an argument.

CheckLoanEligibility(CurrentMember, SelectedItem, RequestedDays)

Here, the interface may define parameters named MemberID, ItemCode and LoanDays, while CurrentMember, SelectedItem and RequestedDays are the arguments used in one particular call.

Exam tip: When interpreting a structure chart, use the term parameter for the labelled value passed through an interface.

Interfaces Between Modules

Interface: the defined connection through which a module receives values and communicates results to another module.

A well-designed interface makes a module easier to understand because its required inputs and produced results are explicit.

Interface question Equipment-loan example
What does the module need? CheckLoanEligibility needs a member identifier, item code and requested duration.
What does the module produce? It produces a Boolean decision and, when required, an explanatory message.
Which details remain internal? The exact search steps used to find the member record do not need to appear in the higher-level interface.
Which module uses the result? The coordinating module uses LoanAllowed to select the next action.

An interface should expose the values needed for communication without exposing every local variable used inside the module.

Common mistake: Do not place every variable from the future algorithm on the structure chart. Show values that need to cross module boundaries.

Following Parameter Directions

The arrow direction shows whether a value is supplied to a lower-level module or returned to the higher-level module.

Direction Meaning Example
Downward The higher-level module supplies a parameter to the lower-level module. MemberID, ItemCode and LoanDays are supplied to CheckLoanEligibility.
Upward The lower-level module supplies a result to its parent. LoanAllowed and RejectionReason are returned to ProcessToolLoan.
Both directions A value is supplied to a module, changed there and returned. AvailableUnits is passed to ReserveItem and returned with its updated value.
Exam tip: Describe both the parameter and the direction: β€œLoanDays is passed down to CheckLoanEligibility.”
Important: A structure chart shows the direction of communication. It does not by itself specify whether a programming language will use pass by value, pass by reference or another implementation mechanism.

Data Values and Control Information

Most parameters represent data that a module processes, such as an identifier, quantity, date or calculated result. A structure chart can also show a control value that influences which module is called or whether work is repeated.

Information type Purpose Example
Data parameter Carries a value to be stored, checked, calculated or displayed. ItemCode, LoanDays, LoanReference
Control flag Communicates a state that affects control decisions. LoanAllowed, MoreRequests
Updated parameter Carries a value into a module and returns its changed value. AvailableUnits
Flag: a Boolean control value used to indicate one of two states, such as TRUE/FALSE or available/not available.

In some structure-chart conventions, an arrow with a filled circular end identifies a control flag. A question may provide its own symbol key, which should always be followed.

Common misconception: A Boolean value is not automatically control information. It acts as control information when it determines which action or module follows.

Showing Selection

Selection is needed when a condition determines which one of several module calls should occur.

In the equipment-loan system:

IF LoanAllowed = TRUE
    call CreateLoan
ELSE
    call DisplayRejection
ENDIF

A structure chart can represent this choice using a diamond or selection marker connected to the alternative modules. The condition should be labelled clearly.

Selection element Equipment-loan interpretation
Control flag LoanAllowed
Condition LoanAllowed = TRUE?
True branch Call CreateLoan
False branch Call DisplayRejection
Common mistake: The selection symbol does not replace the modules on its branches. It indicates the condition that chooses which module is used.
Exam tip: Explain selection in context: β€œThe LoanAllowed flag determines whether the system calls CreateLoan or DisplayRejection.”

Showing Repetition

Repetition notation indicates that one module or a group of modules is called more than once while, or until, a condition is satisfied.

An equipment desk may process requests until its queue is empty:

WHILE MoreRequests = TRUE
    ReadNextRequest
    ProcessToolLoan
    CheckForMoreRequests
ENDWHILE

A curved or semicircular arrow may be drawn over the repeated modules. Its label identifies the repetition condition.

Repetition element Meaning
Repeated group ReadNextRequest, ProcessToolLoan and CheckForMoreRequests
Control flag MoreRequests
Condition Repeat while MoreRequests = TRUE
Common misconception: The curved arrow does not mean that the program repeats forever. Its label should explain the condition that controls repetition.

Values That Are Updated by a Module

Sometimes a module receives a value, changes it and makes the updated value available to its parent. A double-headed arrow can be used to represent this two-way movement.

Suppose the system stores how many units of a tool remain available:

ReserveItem receives AvailableUnits
ReserveItem subtracts 1
ReserveItem returns the updated AvailableUnits
Before the call Module action After the call
AvailableUnits = 4 ReserveItem accepts one loan AvailableUnits = 3
A double-headed parameter arrow indicates that the same named value is supplied to the module and returned with a possible update.
Exam tip: State what changes: β€œAvailableUnits is passed to ReserveItem, reduced when the reservation succeeds and returned to the parent module.”

Worked Example: Community Equipment Loan

A community workshop lends tools to registered members. A loan request contains a member identifier, an item code and the number of requested days.

The system must:

  • read the request;
  • check the member, item and requested duration;
  • create a loan when the request is allowed;
  • show a rejection reason when it is not allowed;
  • update the number of available units after a successful reservation.

Modules and interfaces

Module Parameters received Values produced or updated
ReadLoanRequest None from its parent MemberID, ItemCode, LoanDays
CheckLoanEligibility MemberID, ItemCode, LoanDays LoanAllowed, RejectionReason
ReserveItem ItemCode, AvailableUnits Updated AvailableUnits
CreateLoan MemberID, ItemCode, LoanDays LoanReference
DisplayConfirmation LoanReference, AvailableUnits None
DisplayRejection RejectionReason None

Control design

Control feature Design decision
Selection If LoanAllowed is true, reserve the item, create the loan and display confirmation. Otherwise, display the rejection reason.
Updated value AvailableUnits enters ReserveItem and returns with its reduced value.
Repetition The complete request process repeats while MoreRequests is true.

Text representation of the design

ProcessLoanQueue
└── WHILE MoreRequests
    β”œβ”€β”€ ReadLoanRequest
    β”‚   └── returns MemberID, ItemCode, LoanDays
    β”œβ”€β”€ CheckLoanEligibility
    β”‚   β”œβ”€β”€ receives MemberID, ItemCode, LoanDays
    β”‚   └── returns LoanAllowed, RejectionReason
    └── IF LoanAllowed
        β”œβ”€β”€ ReserveItem
        β”‚   └── updates AvailableUnits
        β”œβ”€β”€ CreateLoan
        β”‚   └── returns LoanReference
        └── DisplayConfirmation
       ELSE
        └── DisplayRejection
Important: This text representation explains the design but is not a substitute for the conventional diagram when a structure chart is requested.

How to Read an Annotated Structure Chart

Read a chart systematically rather than trying to understand every symbol at once.

  1. Identify the parent module. Determine which broad task is coordinating the lower modules.
  2. Identify its children. State the responsibilities of the called modules.
  3. Trace downward parameters. Find the values supplied to each child.
  4. Trace upward parameters. Find results returned to the parent.
  5. Identify control flags. Determine how Boolean results influence the design.
  6. Interpret selection and repetition. State which modules are conditional or repeated.
  7. Locate updated values. Explain any double-headed parameter arrows.
Useful sentence pattern: β€œThe parent module passes [parameter] to [child module]. The child returns [result], which is used to [control or support the next action].”

Adding Interfaces and Control to a Chart

Begin with the module hierarchy. Then annotate it using the information required by each module.

  1. List each module's required inputs. Ask what the module must know before it can perform its task.
  2. List each result. Ask what information another module needs after the task is complete.
  3. Draw and label parameter arrows. Show supplied values and returned results clearly.
  4. Identify Boolean decisions. Decide whether a returned flag controls a selection or repetition.
  5. Add selection notation. Label the condition and its alternative branches.
  6. Add repetition notation. Identify the repeated group and its continuation or stopping condition.
  7. Mark updated parameters. Use two-way notation where a supplied value is changed and returned.
  8. Check the chart. Ensure that every parameter is created before it is passed and used by a module that needs it.
Common mistake: Do not invent parameter arrows merely to make the chart appear detailed. Every labelled value should have a clear purpose in the algorithm design.

Interactive: Structure Chart Interface Explorer

Switch between data passing, selection, repetition and an exam-style challenge. Select any module to inspect its inputs, outputs and control role.

Scenario: community equipment-loan system

Data parameters

Follow values across module interfaces

Select each module to see the values it receives and the results it returns.

Focus: a parameter arrow represents communication across a module boundary.

Element 1 of 5

ProcessToolLoan

This parent module coordinates the request and passes values between its child modules.

Common Mistakes and Misconceptions

  • Leaving arrows unlabelled. A connection without a parameter name does not clearly define the interface.
  • Reversing parameter direction. Check whether the child receives a value or produces it.
  • Showing local variables as interface parameters. Only values crossing module boundaries need to appear.
  • Confusing a flag with ordinary data. Explain which decision or repetition the flag controls.
  • Using a selection diamond as a module. The diamond represents a condition that chooses between module calls.
  • Leaving repetition unlabelled. State when the repeated group continues or stops.
  • Assuming a double-headed arrow specifies pass by reference. It shows an updated value at the design level, not a language-specific mechanism.
  • Showing parameter flow but no module hierarchy. A structure chart must still show parent and child relationships.

Practice

Core questions

  1. Define the term parameter.
  2. Explain what is meant by a module interface.
  3. Explain the difference between a downward and upward parameter arrow.
  4. Explain the purpose of a Boolean flag in a structure chart.
  5. Explain how a structure chart can represent selection.
  6. Explain how a structure chart can represent repetition.
  7. Explain the meaning of a double-headed parameter arrow.
  8. Explain why local variables do not normally need to appear on the interface.

Scenario A: Bicycle-Service Booking

A program reads a customer identifier, bicycle type and requested service. It checks whether the service can be completed on the selected date. An accepted booking produces a reference; a rejected booking produces a reason.

  1. Suggest a suitable top-level module.
  2. Suggest modules for input, checking, booking and output.
  3. List the parameters received and produced by each module.
  4. Identify a suitable Boolean control flag.
  5. Show the selection between confirmation and rejection.
  6. Draw the annotated structure chart.

Scenario B: Community Hall Capacity

A program repeatedly reads group bookings while more requests remain. It checks whether enough seats are available. Accepted bookings reduce the value SeatsAvailable.

  1. Identify the repetition flag.
  2. Identify the selection flag.
  3. Identify the value that is updated.
  4. State which modules receive and return each value.
  5. Draw a structure chart containing repetition, selection and a double-headed arrow.
Challenge: For one completed chart, write a paragraph that traces every parameter from the module that produces it to the module that uses it.

Review

Prompt A strong response should include
Parameter A named value passed through a module interface.
Interface The defined connection through which modules exchange values.
Downward arrow A value supplied by a higher-level module to a lower-level module.
Upward arrow A result supplied by a lower-level module to its parent.
Control flag A Boolean value used to influence selection or repetition.
Selection A labelled condition that chooses between alternative module calls.
Repetition A labelled control symbol showing that modules are called repeatedly.
Double-headed arrow A value is supplied to a module, updated and returned.
Final exam tip: Trace the complete chain: producing module β†’ parameter β†’ arrow direction β†’ receiving module β†’ purpose.