Single lesson · Written for AQA GCSE Computer Science (8525)

Subroutines: procedures and functions – AQA GCSE Computer Science lesson (8525)

Pupils learn to explain what a subroutine is, tell procedures from functions, and write and call both in the class's language and AQA pseudo-code.

Also in a bundle Cyber Security and Robust Programs – AQA GCSE Computer Science lessons (8525) 14 lessons for £39 · save 30% on buying separately

Lesson 2 of 14 in unit 11.1 Cyber Security and Robust Programs, taught in Year 11, Autumn 1. It answers one big question: Why do programmers split code into subroutines?

By the end, pupils can explain what a subroutine is, tell procedures from functions, and write and call both in the class's language and AQA pseudo-code.

The Build (the main task)
Write a program that: has a procedure showConfirmation that outputs Order confirmed; has a function deliveryCost that takes the order total as a parameter and returns 0 if the total is over 50, otherwise 4.99; inputs an order total, calls showConfirmation and outputs the value returned by deliveryCost. You should use indentation and meaningful identifiers. (6 marks) State three advantages of using subroutines. (3 marks)
Support version
Part-filled code with each subroutine's first line written; pupils complete the bodies and the calls.
Challenge
Write a procedure showSizes that outputs every shoe size from 3 to 13, using a loop. Then call it. (4 marks) Rewrite showConfirmation and deliveryCost in AQA pseudo-code, using SUBROUTINE, ENDSUBROUTINE and RETURN. (4 marks) Kickstand packs orders in boxes. Write a program with a function boxSize that takes the number of pairs and returns Small for 1 pair, Medium for 2 or 3 pairs and Large for more. Input the number of pairs and output the box size. (6 marks)
Real-world link
Kickstand's order program: confirm the order and work out delivery.
Key words
Subroutine, Procedure and Function, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“A subroutine runs as soon as it is defined”; “Procedures and functions are the same”.
AQA 8525 specification
3.2.10 (structured programming and subroutines).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Cyber Security and Robust Programs unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.