The shape of the lesson
By the end of the lesson, learners can
- Reading a structure chart: Read Fig. 1 from the top down and from left to right.
- Building a chart: Start with one box for the whole problem.
- Into pseudocode: Each box becomes a module header, and the arrows tell you its parameters.
- Box: a module; a line down means "calls".
- Hollow circle: data; filled circle: flag (Boolean).
- Diamond: selection; curved arrow: iteration.
- Pseudocode: one value up = FUNCTION; down and back up = BYREF; down only = BYVAL.
One picture every idea returns to
A structure chart is a top-down design diagram. Each rectangle is a module (a procedure or function); a line from a module to one below it means the upper module calls the lower one. Short arrows beside the lines show the parameters passed: an arrow with a hollow circle is data; an arrow with a filled circle is a flag (a Boolean). A diamond shows selection (only one of the modules below is called) and a curved arrow shows iteration (the modules are called repeatedly). It shows what each module does and what it needs, not how it does it.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, Draw the modules.. A structure chart is the map of a modular program. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: Reading a structure chart | Read Fig. 1 from the top down and from left to right. | Whole class, then pairs |
| 13 to 21 min | Teach and check: Building a chart | Start with one box for the whole problem. Model the worked example Decompose a problem on the board, one line at a time. Your turn: In Fig. 1, why does the arrow labelled Total pass both down to and up from UpdateTotal? | Pairs |
| 21 to 30 min | Teach and check: Into pseudocode | Each box becomes a module header, and the arrows tell you its parameters. Project tab 5 of the lab (Procedures and functions in pseudocode) and let a student drive it while the class predicts. Your turn: On a chart, Length and Width pass down to a module CalcArea and Area passes up. Write the module header. | Connect-Extend-Challenge |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 16 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in Into pseudocode, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Connect-Extend-Challenge
After the new idea, each student writes three lines: how it connects to what they knew, how it extends their thinking, and what still challenges them. Pairs compare, then the challenges become the plenary.
The full structure, with its variations and the other twelve, is on the cooperative-learning page.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| A structure chart does not show the detailed steps inside a module, and it is not a flowchart. | If a question asks for a structure chart, draw boxes, lines and parameter arrows, not decision boxes and loops of code. |
| Every parameter arrow needs a label and a direction. | An unlabelled arrow, or one with no circle to show data or flag, will not earn the mark. |
| A function is called inside an expression, never with CALL: write Mark ← GetMark(), not CALL GetMark(). | Procedures are called with CALL. |
Structure charts: worksheet
6 questions, 16 marks. Written in the style of the papers; no past paper question is reproduced.
State the purpose of a structure chart.
Explain the difference between the two kinds of parameter arrow on a structure chart.
A program inputs a temperature in Celsius, converts it to Fahrenheit and outputs both. The main module is TempConvert. Describe a structure chart with modules InputTemp, Convert and OutputTemps, giving every parameter and its direction.
On a structure chart, module ReadScores passes the array Scores up to the main module. Scores then passes down to module FindHighest, which passes Highest (an INTEGER) back up. Scores is ARRAY[1:50] OF INTEGER. Write pseudocode for FindHighest.
In a structure chart, a curved arrow crosses the lines from module Main to modules GetItem and AddToBasket. Explain what this shows and how it appears in the pseudocode for Main.
Give two benefits of designing a program with a structure chart before coding it.
Answer key and marking notes
- To show how a problem is decomposed into modules / sub-tasks and the hierarchy of the modules (which module calls which).
- To show the parameters (data and flags) passed between the modules.
- An arrow with a hollow circle is a data couple: a data value passed between modules.
- An arrow with a filled circle is a flag: a Boolean value that tells the receiving module about a condition / controls what it does.
- TempConvert at the top, calling InputTemp, Convert and OutputTemps (left to right) below it.
- Celsius passes up from InputTemp to TempConvert.
- Celsius passes down to Convert; Fahrenheit passes up from Convert.
- Celsius and Fahrenheit pass down to OutputTemps; all are data couples (hollow circles).
- Header: FUNCTION FindHighest(Scores : ARRAY[1:50] OF INTEGER) RETURNS INTEGER (accept an equivalent array parameter).
- Initialise Highest ← Scores[1].
- FOR Index ← 2 TO 50 with IF Scores[Index] > Highest THEN Highest ← Scores[Index] ENDIF, NEXT Index.
- RETURN Highest, ENDFUNCTION.
- It shows iteration: GetItem and AddToBasket are called repeatedly (in that order).
- In Main, the calls to GetItem and AddToBasket are inside a loop (e.g. WHILE / REPEAT / FOR).
- The problem is decomposed into modules that can be written and tested independently, possibly by different programmers.
- The interfaces (parameters) between modules are agreed in advance, so the modules fit together / modules can be reused.
6 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
On a structure chart, a line joins module A to module B, which is drawn directly below it. What does this show?
- AModule A calls module B
- BModule B calls module A
- CModules A and B run at the same time
- DModule B must be written before module A
Which of these is not shown on a structure chart?
- AThe detailed steps and decisions carried out inside each module
- BWhich modules are called by which other modules
- CThe data and flags that are passed between the modules
- DWhether some of the modules are called repeatedly
Which statement about the structure chart in the figure is correct?
- AGetItems and CalcTotal are called repeatedly; ChooseDelivery calls either StandardPost or CourierPost
- BGetItems and CalcTotal are called repeatedly; ChooseDelivery calls StandardPost and then CourierPost
- CStandardPost and CourierPost are called repeatedly; GetItems and CalcTotal are each called only once
- DCalcTotal calls GetItems repeatedly; ProcessOrder chooses between ChooseDelivery and CalcTotal
On a structure chart, Price (a data couple) and Member (a flag) pass down to module CalcDiscount, and Discount (a data couple) passes back up. Which pseudocode header matches?
- A
FUNCTION CalcDiscount(Price : REAL, Member : BOOLEAN) RETURNS REAL - B
PROCEDURE CalcDiscount(BYVAL Price : REAL, Member : BOOLEAN) - C
FUNCTION CalcDiscount(Discount : REAL) RETURNS BOOLEAN - D
FUNCTION CalcDiscount(BYREF Price : REAL, Member : BOOLEAN) RETURNS REAL
In the structure chart in the figure, Express passes down from ProcessOrder to ChooseDelivery and nothing passes back. Which header for ChooseDelivery matches the chart?
- A
PROCEDURE ChooseDelivery(Express : BOOLEAN) - B
FUNCTION ChooseDelivery() RETURNS BOOLEAN - C
PROCEDURE ChooseDelivery(Express : STRING) - D
FUNCTION ChooseDelivery(Express : BOOLEAN) RETURNS REAL
This is the pseudocode for module Main.
PROCEDURE Main()
DECLARE Choice : INTEGER
REPEAT
Choice ← GetChoice()
IF Choice = 1 THEN
CALL AddRecord()
ELSE
IF Choice = 2 THEN
CALL DeleteRecord()
ENDIF
ENDIF
UNTIL Choice = 0
ENDPROCEDUREWhich symbols must appear below Main on its structure chart?- AA curved arrow across the lines to all three modules, and a diamond where the lines to AddRecord and DeleteRecord leave Main
- BOnly a diamond where the lines to AddRecord and DeleteRecord leave Main, because IF chooses which module runs
- COnly a curved arrow across the lines to all three modules, because every call is inside the loop
- DA flag with a filled circle for Choice coming up from GetChoice, and no other symbols at all
Quiz key
A line from a module down to a module below it means the upper module calls the lower one, so A calls B. The lower module never calls the one above it on the chart. The chart says nothing about running modules at the same time, and modules can be written in any order (stubs can stand in for those not yet written).
A structure chart shows the hierarchy of calls, the parameters (data couples and flags) passed between modules, and selection and iteration of calls. The detailed steps inside a module belong in pseudocode or a flowchart.
The curved arrow crosses the lines to GetItems and CalcTotal, so ProcessOrder calls them repeatedly. The diamond below ChooseDelivery shows selection: only one of StandardPost and CourierPost is called each time. Calling both ignores the diamond. The curved arrow is under ProcessOrder, not under the post modules. GetItems is drawn beside CalcTotal, not below it, so CalcTotal does not call it.
Two values go down (a REAL and a BOOLEAN flag) and exactly one value comes up, so it is a function with those parameters returning a REAL. A procedure with only BYVAL parameters cannot pass Discount back. The third header confuses what goes down with what comes up. The guide says parameters should not be passed by reference to a function.
The arrow points down and has a filled circle, so it is a flag (a BOOLEAN) passed in, and nothing comes back: a procedure with one BOOLEAN parameter (BYVAL by default). A function returning BOOLEAN would mean the flag passes up. A STRING ignores the filled circle, which marks a flag. Returning a REAL would need a data couple passing back up, and there is none.
All three calls are inside the REPEAT loop, so a curved arrow (iteration) crosses all three lines, and the IF means only one of AddRecord and DeleteRecord is called each pass, so a diamond (selection) is needed too. A diamond alone or a curved arrow alone misses one of the two constructs. Choice is an INTEGER, so it is a data couple (hollow circle), not a flag, and the other symbols would still be missing.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.