Study Guide Instructor view

Solving Problems with Algorithms

Teaching notes for Lesson 5.1, with controls for presenting it.

Keep this page on your own screen. Share only the lesson window. The lesson window holds no teaching notes, so sharing it cannot show them.

Presenting

  1. Open the lesson in its own window and share that window, not this one.
  2. Use Next and Previous here, or the lesson’s own, to move through the lesson. Next reveals one thing at a time: the next idea, or the answer to the question on screen, then the next step. Previous takes the last reveal back. The line below says what is on screen and what Next will show.
  3. Reveal hints and answers when the class is ready, and reset a demonstration before using it again.

The controls need JavaScript and a browser that supports BroadcastChannel. Without them, open the lesson in presentation mode and use its own controls.

The two windows talk to each other only inside this browser, on this device. Nothing is sent to a server, and no account is needed. A second device (a phone or another tablet) cannot follow the lesson window yet.

Lesson plan

Level
Beginner
Time
About 60 minutes; the steps below add up to 60

Pupils start from a project they can picture, a lunch-ordering app for a fictional school, and put the jobs of a project in order before they are told the four stages of the program development life cycle. They then meet abstraction (what to keep), decomposition (how to split), the four-part description of a sub-system (inputs, processes, outputs, storage), structure diagrams, and the habit of stating the purpose of an algorithm instead of listing its steps. The lesson ends with pupils explaining why planning matters and classifying a new planning scene, so you see whether the vocabulary is attached to the right ideas.

Objectives

  • Name the four stages of the program development life cycle and say what is done at each
  • Explain abstraction and decomposition, and use each on a given problem
  • Describe a system as sub-systems, and describe a part of a problem by its inputs, processes, outputs and storage
  • Read and complete a structure diagram
  • State the purpose of a given algorithm, rather than repeating its steps

Before the lesson

  • Mini whiteboards or paper, one per pupil, for the think questions and for the tree drawing in step 7.
  • Write the four jobs from step 2 on four separate strips or cards so that pairs can physically reorder them.
  • Have the indented structure diagram of the lunch app ready to show on the board; you will build the sports-day diagram as a tree during step 7.
  • Decide in advance whether pupils work in pairs on the table task in step 6; the answers are short, so a quick whole-class check works well too.

Steps

  1. Introduction Opening

    On screen: the lesson’s title, module and number; Next adds its objectives and key terms, as the lesson page lists them; Next again begins the first step.

    Objectives on screen

    • Name the four stages of the program development life cycle and say what is done at each
    • Explain abstraction and decomposition, and use each on a given problem
    • Describe a system as sub-systems, and describe a part of a problem by its inputs, processes, outputs and storage
    • Read and complete a structure diagram
    • State the purpose of a given algorithm, rather than repeating its steps

    Purpose: Pupils start from a project they can picture, a lunch-ordering app for a fictional school, and put the jobs of a project in order before they are told the four stages of the program development life cycle. They then meet abstraction (what to keep), decomposition (how to split), the four-part description of a sub-system (inputs, processes, outputs, storage), structure diagrams, and the habit of stating the purpose of an algorithm instead of listing its steps. The lesson ends with pupils explaining why planning matters and classifying a new planning scene, so you see whether the vocabulary is attached to the right ideas.

  2. 1. An app for the canteen Think 4 min

    Purpose: Open with a project pupils can imagine so that the life cycle later names something they already believe: you find out what is needed before you build.

    Ask

    • Priya is ready to type. What should she do first?
    • What could go wrong if she builds the wrong thing very well?

    Responses to expect

    • Ask the canteen what they want
    • Plan it
    • Some will say start with the log-in screen or the menu

    Misconceptions to challenge

    • A learner may believe: “Programmers start by writing code, and anything else is wasted time.” Respond: Ask: if Priya spends a week coding an app that takes payment by card but the school only wants pre-paid credit, how much of the week was useful?

    What learners should notice

    • Nobody has mentioned the word life cycle yet; pupils are generating the idea from experience.

    Checking understanding: Pupils write their first job on a mini whiteboard and hold it up together; scan for any that say a coding task.

    Depending on the answers

    • If most pupils say write the code: ask them to imagine a school that wants a different app from the one Priya built, and ask how Priya could have avoided that; collect find out first before moving on.

    English as an additional language

    • Check the words pre-order, kitchen and canteen before reading the scenario aloud; a picture of a lunch queue helps.

    Discussion pause: Thirty seconds of silent thinking, then pairs agree one first job before anyone shares.

    In the lesson window

    • Think it through: Priya has a laptop open and is ready to type. What should she do first, before she writes any code, and why?
  3. 2. Putting the jobs in order Discover 7 min

    Purpose: Pupils sort four jobs into an order and defend it, so that analysis, design, coding and testing arrive as names for an order they chose. The check then tests which stage is missing from a described project.

    Ask

    • Which job did you put first, and which last? Why?
    • Priya has found out what is needed and starts typing code. Which job has she skipped?

    Responses to expect

    • Find out, plan, code, test
    • Some put testing before coding because they are testing the idea
    • The answer to skipped-stage is design, the planning job

    Misconceptions to challenge

    • A learner may believe: “Planning means writing the program in rough.” Respond: Planning is done on paper before any code: diagrams and pseudocode. Ask pupils what they could draw to plan the app without typing a line.
    • A learner may believe: “The cycle runs once, in a straight line, and is then finished.” Respond: Ask what Priya should do if testing shows a mistake in the design; she goes back, which is why it is called a cycle.
    • A learner may believe: “Testing at the very end is the only testing that happens.” Respond: Point to iterative testing in the coding row of the table and return to it in step 9.

    On the board or with the pen

    • Write the four stage names down the left of the board as pupils name them, with an arrow from testing back up to design to show the cycle.

    Checking understanding: The skipped-stage question: the analysis option is a trap for pupils who read she talked to the staff as nothing done.

    Depending on the answers

    • If several choose analysis: ask them to read the first sentence of the scenario again and name what Priya did there; she did analysis, so the missing stage is the one between analysis and coding.
    • If most get design at once: ask what code Priya might have to rewrite, and why, if she skips design.

    Support

    • Give pupils the four jobs on cards to physically order, then ask them to turn over the card for the job that is missing.

    English as an additional language

    • Check requirements and test data in advance; show each stage with one verb: find out, plan, write, check.

    In the lesson window

    • Think it through: Put the four jobs in the order you would do them. Give one reason for the job you put first and one for the job you put last.
    • Check your understanding: Priya talks to the canteen staff and writes down exactly what the app must do. Then she starts typing code straight away. Which stage has she missed out?
  4. 3. Keeping what matters Discover 6 min

    Purpose: Pupils decide for themselves which details the app needs, so that abstraction is met as a decision before it is named. The check then applies the word to a new context (bus colours).

    Ask

    • For each detail, would the app behave differently without it?
    • Why do the prices matter and the wall colour not?
    • A bus-timetable app does not need the colour of the buses. What has the programmer done?

    Responses to expect

    • Menu, prices, allergy information and pupil ID are needed; wall colour and fridge make are not
    • Some argue the allergy information is optional; probe: what if the kitchen serves a nut to a pupil who is allergic?
    • Abstraction is the answer to abstraction-check

    Misconceptions to challenge

    • A learner may believe: “Leaving details out means the problem is being simplified by making it wrong.” Respond: A bus map leaves out the shops and the houses and is still correct for its job. Ask: what would the map look like if it kept everything?
    • A learner may believe: “Abstraction is the same as decomposition because both make the problem easier.” Respond: Hold up the bus map: it has fewer details (abstraction), but nothing has been cut into parts. Decomposition comes next.

    On the board or with the pen

    • Draw two columns, needs to know and can ignore, and place the six details as pupils argue for them.

    Follow-up questions

    • Which detail would you add if the school wanted the app to show calories?

    Checking understanding: Count hands on the allergy information: if pupils say it can be ignored, ask the nut question before moving on.

    Depending on the answers

    • If pupils choose decomposition in the check: ask them what was split into parts in the bus story; nothing was, something was left out.

    English as an additional language

    • Explain ignore and detail with gestures; an everyday example is a school map that leaves out the toilets of the staff room.

    In the lesson window

    • Think it through: Which of these does the lunch-ordering app need to know about, and which can it ignore? (1) the meals on the menu; (2) the colour of the dining-hall walls; (3) the price of each meal; (4) the make of the kitchen’s fridges; (5) which meals contain nuts; (6) each pupil’s name or ID.
    • Check your understanding: A programmer designing a bus-timetable app decides it does not need to know the colour of the buses. What has the programmer done?
  5. 4. Breaking a problem into parts Discover 6 min

    Purpose: Pupils list the smaller jobs themselves, then the lesson names decomposition and sub-system and separates it from abstraction with a DoNotConfuse card. The apply question tests the separation in a new scene.

    Ask

    • What are the smaller jobs between opening the app and the kitchen cooking?
    • In the sports-day program, was anything left out, or was the problem split up?

    Responses to expect

    • Log in, choose, pay, tell the kitchen, in some order
    • Lists will differ in size; both fine-grained and coarse lists are acceptable
    • Decomposition is the answer to sports-day

    Misconceptions to challenge

    • A learner may believe: “Splitting a problem into parts makes it simpler, so it is abstraction.” Respond: Abstraction decides what to keep; decomposition decides how to split. In the sports-day program every part is still needed; the problem is just in three pieces.
    • A learner may believe: “A sub-system is a small computer.” Respond: A sub-system is a smaller system that does one job, such as checking the balance; it need not be a separate device.
    • A learner may believe: “Each part must be the same size.” Respond: Parts differ: Pay can be broken down again, Log in may not need to be.

    On the board or with the pen

    • Write the pupils' list as boxes in a row along the board; leave space beneath Pay for step 7.

    Checking understanding: The sports-day apply question: the abstraction option diagnoses pupils who equate simpler with abstraction.

    Depending on the answers

    • If more than a few choose abstraction: ask them to name the detail that was left out; when no one can, return to the DoNotConfuse card and its two questions: what do I keep, how do I split it up.

    Stretch

    • Break Take payment into smaller sub-systems. When does a part become small enough to stop splitting?

    English as an additional language

    • Teach decompose by its parts: de- (take apart) and compose (put together); show a toy being taken apart.

    In the lesson window

    • Think it through: List the smaller jobs the app has to do, from the moment a pupil opens it to the moment the kitchen starts cooking.
    • Apply it: A team writing a sports-day program decides it will be made of three parts: entering the results, working out each runner’s position, and displaying a scoreboard. Which technique has the team used?
  6. 5. Describing one part Explain 8 min

    Purpose: Pupils generate the four kinds of thing in a Pay sub-system before the headings are given, then follow a fully worked example, then check the idea on a new item (the list of books).

    Ask

    • What must go in, what must the program work out, what comes out, and what is kept until tomorrow?
    • Why does the library record need storing and not just displaying?
    • A list of every book kept for tomorrow: which of the four is it?

    Responses to expect

    • Meal and pupil ID in; balance check; Paid or Not enough credit out; new balance stored
    • Storage is the answer to storage-or-input

    Misconceptions to challenge

    • A learner may believe: “Storage means the screen or the thing the user sees.” Respond: What the user sees is output. Storage is data still there after the program stops and the next time it is used.
    • A learner may believe: “Anything the program reads is input.” Respond: Input is data going in for this task. A list of books that was already kept and is there every day is storage, even though it is read.
    • A learner may believe: “A process is any noun on the list.” Respond: A process is an action: calculating, comparing, checking. Test it: could you put do before it?

    On the board or with the pen

    • Draw four boxes in a row labelled in, process, out, kept, with an arrow through the first three and a cylinder for kept; fill them in for Borrow a book as the callout is read.

    What learners should notice

    • In the worked example, inputs and outputs are decided before processes; ask why that order stops anything being forgotten.

    Checking understanding: The storage-or-input question: each wrong option names a plausible confusion (input, process, output) and the feedback probes it.

    Depending on the answers

    • If pupils say input because the program has to read it: ask: is the list typed in each time, or is it there already? Then restate storage as data that stays between uses.
    • If pupils fill in the four boxes easily: ask them to choose a sub-system of their own, such as set a reminder, and describe it in the same four boxes.

    Support

    • Give pupils the four headings on a card and ask them to answer each as a question: what goes in? what is worked out? what comes out? what is kept?

    English as an additional language

    • Check output and storage; show a floppy or cylinder symbol for storage, a screen for output.

    In the lesson window

    • Think it through: For this one sub-system, write one example of each: something that goes in, something the program must work out, something that comes out, and something that must be remembered until tomorrow.
    • Check your understanding: The library’s list of every book it owns is kept so that it is still there tomorrow. Which of the four does that list belong to?
  7. 6. Sorting a late-fine system Apply 5 min

    Purpose: Pupils classify five items from a late-fine system as input, process, output or storage, with feedback on each cell, including the tricky clock input.

    Ask

    • For each item: does it go in, get worked on, come out, or stay for later?
    • Today's date from the clock: input or something else?

    Responses to expect

    • Card number input, fine calculation process, 30p message output, total unpaid fines storage, date input
    • A few will call the date storage or process

    Misconceptions to challenge

    • A learner may believe: “Input has to be typed by a person.” Respond: Data entering the part is input even when it comes from a clock; the table explanation says this, so check it was read.
    • A learner may believe: “The total unpaid fines are an output because the librarian sees them.” Respond: Ask whether it still has to exist after the program stops; that is the storage test.

    Checking understanding: Check cell by cell which pupils have wrong answers: the pattern shows which of the four is least secure.

    Depending on the answers

    • If most pupils get the clock wrong: ask where the data comes from relative to the part: outside or inside? Then ask what the part does with it.
    • If pupils finish quickly: ask them to add two more items to the late-fine part and sort them for a partner.

    Support

    • Allow pupils to use the hint button on the first two rows and then try the rest without.

    Stretch

    • What would you store so that a pupil cannot borrow while they have unpaid fines?
  8. 7. Drawing the breakdown Explain 7 min

    Purpose: Pupils draw their own tree of the app, then meet the name structure diagram, read one, and complete a second as a table of which box sits directly above which.

    Ask

    • Draw the app as a tree: the whole at the top, four main parts, and three parts for Pay.
    • In the diagram, which box is a sub-system of Pay?
    • What does each line in the diagram join?

    Responses to expect

    • A box at the top, four beneath, three beneath Pay
    • Take payment is the answer
    • Some draw the boxes in a row with no whole at the top

    Misconceptions to challenge

    • A learner may believe: “A structure diagram shows the order the steps happen in.” Respond: It shows what contains what, not time order. Ask: does the diagram tell you whether Pay happens before Tell kitchen?
    • A learner may believe: “Boxes beside each other are parts of each other.” Respond: Look at the indentation: Tell kitchen sits at the same level as Pay, so it is not part of Pay.
    • A learner may believe: “The top box is just another part.” Respond: It is the whole system; everything else is a part of it.

    On the board or with the pen

    • Draw the lunch-app tree at full size with the pen as pupils call out the boxes; then draw the sports-day tree from the table answers on a clear space.

    Follow-up questions

    • Which boxes in the sports-day diagram are small enough to build directly?

    Checking understanding: The sports-day table shows who can read a diagram as a tree: Type in times and Type in names should sit beneath Enter results, not beneath the top box.

    Depending on the answers

    • If a pupil puts Type in times beneath Sports day results: ask which job typing the times is part of; check whether it is a main part or a part of a part.

    Support

    • Provide the box names on slips of paper that pupils arrange into a tree before they fill the table.

    English as an additional language

    • Show indented and directly above with a gesture; read each table row aloud as: this box is directly under which?

    In the lesson window

    • Think it through: On paper, draw the lunch app as a tree: the whole app at the top, its four main parts below it, and the three parts of “Pay” below that. Use boxes and lines.
    • Check your understanding: In this structure diagram, which box is a sub-system of Pay?
  9. 8. What is this algorithm for? Predict 7 min

    Purpose: Pupils state the purpose of a short algorithm by running it on real marks, then learn the difference between stating a purpose and describing steps. The highest-mark algorithm tests the habit, and Sam's answer is a worked wrong one to correct.

    Ask

    • In one sentence, what is the averaging algorithm for, without listing the steps?
    • Try 4, 9, 6 in the Biggest algorithm: what does the user get told?
    • What is wrong with Sam's answer?

    Responses to expect

    • It works out the average of five marks: pupils often list the steps first
    • Biggest ends at 9, so it finds the highest mark
    • Sam has described the steps, not the goal

    Misconceptions to challenge

    • A learner may believe: “The purpose of an algorithm is its steps written out.” Respond: Ask what the user wants from it. The user wants the highest mark; the steps are how the algorithm gets there.
    • A learner may believe: “A purpose must be a long, detailed sentence.” Respond: A purpose is short: finds the highest mark. Length is not what makes it accurate.
    • A learner may believe: “Biggest ends up as the last mark entered.” Respond: Run 9, 6, 4 and ask what Biggest holds at the end.

    On the board or with the pen

    • Write the marks 4, 9, 6 in a row and track Biggest beneath with the pen: 4, 9, 9. Do the same for the sum-and-divide algorithm with 4, 6, 8, 6, 6, writing the running total 4, 10, 18, 24, 30, then 6.

    Checking understanding: The purpose-check question: the add up and put in order options catch pupils who read a step and not the result. Sam's question separates goal from method.

    Depending on the answers

    • If pupils say it adds all the marks: run 4, 9, 6 on the board and ask them what Biggest is at the end; the answer is not 19.
    • If pupils write a good one-sentence purpose for the average: ask them to write the purpose of the highest-mark algorithm in five words or fewer.

    Stretch

    • Write an algorithm of your own in plain numbered steps and swap with a partner, who states its purpose.

    English as an additional language

    • Teach purpose with a simple parallel: the purpose of a kettle is to boil water; its steps are what happens inside.

    In the lesson window

    • Think it through: In one sentence, what is this algorithm for? Try to say it without listing the steps.
    • Check your understanding: A fictional teacher’s algorithm does this: 1. Set Biggest to the first mark. 2. For every other mark, if it is bigger than Biggest, replace Biggest with it. 3. Tell the user Biggest. What is its purpose?
    • Apply it: For the same algorithm, Sam writes: “Its purpose is to set Biggest to the first mark, compare each other mark with it, and tell the user Biggest.” What is wrong with Sam’s answer?
  10. 9. Coding and testing in practice Apply 5 min

    Purpose: Pupils work out why testing as you go helps, so that iterative testing and the separate testing stage are two ideas they can tell apart. The apply question tests the testing stage on a new scene.

    Ask

    • What should Priya do differently next time, and why would it have helped?
    • She runs the finished app with ten sample orders whose totals she worked out earlier: which stage is she in?

    Responses to expect

    • Write a little, run it, fix it, then add more
    • Testing, because the finished program is run with test data
    • Some pupils choose coding because she is working on the program

    Misconceptions to challenge

    • A learner may believe: “Iterative testing and the testing stage are the same thing.” Respond: Iterative testing is small tests while coding. The testing stage runs the finished program with test data and compares with the requirements.
    • A learner may believe: “Test data is any numbers you type in.” Respond: Test data is chosen on purpose with the correct results already worked out. Ask: how would Priya know the total on screen is right if she had not worked it out first?

    On the board or with the pen

    • Draw two timelines side by side: 400 lines written then one huge test, against four 100-line chunks each followed by a test; mark where a fault could be in each.

    Checking understanding: The which-stage question: each wrong option names a stage with a plausible reason; the feedback asks which stage runs the finished program.

    Depending on the answers

    • If pupils choose coding: ask whether the program is still being written; then ask what the stage is called when a finished program is checked.

    English as an additional language

    • Check iterative: repeating in small rounds. A diagram with arrows going round helps.

    In the lesson window

    • Think it through: What would you advise her to do differently next time, and why would it have helped?
    • Apply it: Priya runs the finished app with ten sample orders whose correct totals she worked out beforehand, and compares them with the totals on screen. Which stage is she in?
  11. 10. Show what you know Consolidate 5 min

    Purpose: Pupils explain, in their own words, why planning matters using at least two stages, then classify a new scene (bus planners drawing boxes) before the summary.

    Ask

    • Explain to a friend why start typing is risky. Name two stages.
    • The bus planners draw boxes before any code: which stage, which technique?

    Responses to expect

    • Analysis stops you building the wrong thing, design lets parts fit, testing needs test data
    • Design, using a structure diagram

    Misconceptions to challenge

    • A learner may believe: “Drawing boxes is coding in a different form.” Respond: Coding writes the program. Boxes are a plan on paper, which is design.
    • A learner may believe: “Using a structure diagram is abstraction.” Respond: A structure diagram shows decomposition: the parts, not the left-out details.

    Checking understanding: Collect the explanations: a good answer names a stage and what it prevents. Note which stage pupils leave out; it is probably the one they find least concrete.

    Depending on the answers

    • If pupils name stages without saying what each prevents: ask for one sentence each: if you skip this stage, what goes wrong?
    • If several are unsure of abstraction against decomposition: open the next lesson with the DoNotConfuse card and a two-minute quick quiz.

    Stretch

    • Describe a project you have done (a poster, a game) in the four stages, noting where you went back.

    In the lesson window

    • Think it through: A friend says: “I don’t need to plan, I just start typing code.” Explain to your friend why that is risky. Name at least two stages of the life cycle in your answer.
    • Apply it: A town’s fictional bus company wants an app that tells passengers when their bus will arrive. Its planners draw boxes for “Look up the stop”, “Find the next bus” and “Show the time”. Which stage of the life cycle are they in, and which technique have they used?
  12. Lesson recap Closing

    On screen: the lesson’s objectives again; Next adds the closing question, which asks the class to explain each one in their own words without looking back. It says nothing about what anyone has learnt: use the answers to decide what to revisit.

    Points to listen for

    • Four stages: analysis (what is needed), design (a plan), coding (write, testing as you go), testing (finished program, test data).
    • Abstraction keeps what matters; decomposition breaks a problem into sub-systems.
    • Describe any part by its inputs, processes, outputs and storage: storage is data kept for later.
    • A structure diagram shows the whole at the top and each part beneath the box it belongs to.
    • State an algorithm's purpose as its goal in a few words; describe the steps only when asked to.

Consolidation

  • Four stages: analysis (what is needed), design (a plan), coding (write, testing as you go), testing (finished program, test data).
  • Abstraction keeps what matters; decomposition breaks a problem into sub-systems.
  • Describe any part by its inputs, processes, outputs and storage: storage is data kept for later.
  • A structure diagram shows the whole at the top and each part beneath the box it belongs to.
  • State an algorithm's purpose as its goal in a few words; describe the steps only when asked to.