This resource focuses on AQA GCSE Computer Science 3.2.10 Structured programming and subroutines. It is designed to help teachers teach the specification point precisely, without the lesson turning into a grand tour of every programming feature ever invented. The emphasis here is on what students need to understand about subroutines, parameters, return values, and the advantages of structuring code into manageable parts.
For AQA, this topic is not just about spotting the words procedure and function. Students need to understand why subroutines matter, how data is passed into them, how values can be returned, and how structured programming helps produce code that is clearer, reusable, and easier to test. This page is built to help teachers explain that clearly, teach it practically, and mark it with confidence.
At a Glance
🧭 Specification context: AQA GCSE Computer Science 3.2.10 within programming.
Students must know: what a subroutine is, why subroutines are useful, how parameters pass data into a subroutine, and how return values pass data back to the calling routine.
Key exam focus: precise explanation of procedures and functions, correct use of parameters, and understanding why structured code is easier to develop, test, and maintain.
In scope: procedures, functions, calling subroutines, multiple parameters, return values, and the benefits of decomposition.
Common student challenges: confusing parameters with arguments, mixing up procedures and functions, and assuming any repeated code is automatically structured well.
Understanding the Topic
Where this sits in the specification
This specification point sits within the AQA programming content and links closely to decomposition, algorithm design, and code quality. The core idea is that a large problem can be broken into smaller, named parts. Each part can perform a specific task, and the main program can call those parts when needed.
That means students are not just learning a definition. They are learning a way to organise programs so they are:
- easier to read
- easier to test
- easier to reuse
- easier to debug
- less repetitive
What is a subroutine?
A subroutine is a named block of code written to carry out a particular task. Instead of writing the same steps again and again in the main program, the program can simply call the subroutine.
AQA describes a subroutine as a named out-of-line block of code. In classroom terms, that means the code is written separately from the main body of the program and used when needed.
There are two main types students usually meet:
- Procedure: performs a task but does not return a value
- Function: performs a task and returns a value to the calling code
💡 Teacher shortcut: if students can explain that a procedure does something and a function does something and gives a value back, they usually have the right starting point.
Why structured programming matters
Structured programming is about organising code into clear, logical sections instead of one long, tangled block. Subroutines are a key part of that structure.
Advantages students should be able to explain:
- Reduces repetition because code can be written once and reused
- Improves readability because each subroutine has a clear purpose
- Makes testing easier because each part can be checked separately
- Makes debugging easier because faults can be isolated more quickly
- Improves maintenance because one change in a subroutine can update behaviour everywhere it is called
Parameters and passing data in
A parameter is a value supplied to a subroutine so it can work with specific data. This matters because a subroutine becomes much more useful when it does not only work with one fixed value.
For AQA, students should be able to:
- describe how data is passed into a subroutine using parameters
- use subroutines with more than one parameter
- understand that the values inside the brackets are used by the subroutine to perform its task
For example, a function that calculates an area is more useful if it accepts both length and width rather than only working for one rectangle in the history of rectangles.
Return values and passing data out
Some subroutines return a value to the calling routine. This is the key feature of a function.
Students should understand that:
- the function is called
- it processes the input data
- it returns a result
- the main program can then use that result elsewhere
For example, a function might calculate a total, find the maximum number, or validate whether an entry meets a rule, then return the outcome.
A simple model
Example of a procedure with parameters
PROCEDURE greetUser(name)
OUTPUT "Hello " + name
ENDPROCEDURE
CALL greetUser("Amina")
What this shows: the procedure performs a task and uses a parameter, but it does not return a value.
Example of a function with two parameters and a return value
FUNCTION calculateArea(length, width)
RETURN length * width
ENDFUNCTION
area ← calculateArea(5, 3)
OUTPUT area
What this shows: data is passed in through two parameters, a value is returned, and the main program uses that returned value.
What students often muddle
- thinking every subroutine returns a value
- using the word parameter when they really mean the returned value
- writing a function but never using what it returns
- describing code reuse vaguely without linking it to readability, testing, or maintenance
- thinking structured programming just means “using indentation nicely”
Key Terms and Concepts
| Term | Explanation |
|---|---|
| Structured programming | Organising code into clear logical sections, often using subroutines, so programs are easier to read, test, and maintain. |
| Subroutine | A named block of code that performs a specific task and can be called from elsewhere in the program. |
| Procedure | A subroutine that carries out a task but does not return a value. |
| Function | A subroutine that returns a value to the calling routine. |
| Call | The instruction that runs a subroutine. |
| Parameter | A value passed into a subroutine so it can work with given data. |
| Return value | The result sent back from a function to the calling routine. |
| Reuse | Using the same code multiple times instead of rewriting it. |
| Maintainability | How easy a program is to update, improve, or fix. |
How to Teach This Topic
Teaching moves that work well
- Start with a repetitive piece of code and ask students what feels inefficient about it.
- Replace the repeated section with a named subroutine.
- Introduce procedures first, then functions.
- Model parameters using a familiar example, such as a greeting or area calculation.
- Emphasise that one subroutine can be reused with different inputs.
Marking-aware teaching tips
- Make students state whether a subroutine is a procedure or function and justify the choice.
- Ask students to explain the purpose of each parameter out loud before they code.
- Insist that returned values are actually stored or used.
- Use trace questions where students predict the output after a function call.
- Reward precise explanation of advantages, not just “it makes it better”.
Practical classroom sequence
- Hook: show a short repeated code pattern and ask how it could be improved.
- Direct teaching: define subroutine, procedure, function, parameter, and return value.
- Model: turn repeated code into a procedure.
- Extend: upgrade to a function that returns a value.
- Apply: students write a subroutine with two parameters.
- Exam link: students explain two advantages of using subroutines in a six-line answer, not a vague cloud of optimism.
Discussion prompts
- Why is a named subroutine more useful than copying the same code several times?
- What is the difference between passing data in and returning data out?
- When would a procedure be enough?
- When is a function more useful?
- Why do subroutines make debugging easier?
Scaffolding ideas
- Provide a completed subroutine and ask students to label the name, parameters, and return value.
- Give students sentence frames such as:
- “A subroutine is useful because...”
- “The parameter is used to...”
- “This must be a function because...”
- Use code completion tasks where students fill in missing parameters or missing
RETURNstatements. - Ask students to rewrite a long block of repeated pseudocode as a single reusable subroutine.
🧱 Teaching reminder: students often remember that subroutines reduce repetition, but forget the equally important exam points about readability, testing, debugging, and maintenance.
Extension activities
- Compare a program with repeated code against one using subroutines and ask which is easier to maintain.
- Ask students to turn a procedure into a function.
- Challenge students to write a function with two parameters and explain each stage of the data flow.
How to Mark This Topic Effectively
What strong answers usually contain
- a correct definition of a subroutine
- clear distinction between procedures and functions
- accurate explanation of parameters
- recognition that functions return values
- specific advantages such as reuse, readability, testing, debugging, and maintenance
What weaker answers often do
- say subroutines “store data” instead of perform tasks
- confuse parameters with return values
- say a procedure returns an answer
- give one vague advantage such as “it is easier” with no explanation
- write a function but forget to use
RETURN
| Feature | What to reward | What to watch for |
|---|---|---|
| Definition of subroutine | Named block of code for a specific task that can be called when needed. | Vague answers that describe it as just a “bit of code” with no purpose. |
| Procedure vs function | Clear distinction based on whether a value is returned. | Students using the terms interchangeably. |
| Parameters | Explanation that data is passed into the subroutine through parameters. | Confusing parameters with variables created later or with output values. |
| Return value | Correct explanation that a function sends a result back to the calling routine. | No RETURN, or no use of the returned value. |
| Advantages | Specific benefits linked to code quality. | Generic statements such as “better” or “quicker” with no explanation. |
Distinguishing weak, secure, and strong responses
Secure response
- defines subroutines accurately
- identifies a function by its return value
- explains at least one clear advantage
- uses parameters correctly
Strong response
- does all of the secure points
- uses precise terminology throughout
- explains multiple advantages clearly
- shows how data moves into and out of the subroutine
- avoids unnecessary waffle and irrelevant language features
✅ Examiner-style reminder: reward precise technical language. “It saves time” is a start. “It reduces code duplication so updates only need to be made in one place” is far stronger.
Example Student Responses
Example question
A programmer wants to calculate the total price of items including VAT. They write a function called addVAT.
Question: Write a function called addVAT that takes two parameters, price and rate, and returns the total price after VAT has been added. Then explain why using a function is better than rewriting the calculation each time.
Marks: 6
Marking guidelines:
- 1 mark for a correct function name
- 1 mark for two parameters
- 1 mark for a correct VAT calculation
- 1 mark for a valid return value
- up to 2 marks for explained advantages such as reuse, readability, testing, or maintenance
Strong response
FUNCTION addVAT(price, rate)
RETURN price + (price * rate)
ENDFUNCTION
A function is better because the same code can be reused whenever VAT needs to be added. It also makes the main program shorter and easier to maintain, because if the calculation changes it only needs updating in one place.
Why this is strong:
- uses a function rather than a procedure
- includes two parameters
- returns a value correctly
- explains advantages with specific detail
Weak response
PROCEDURE addVAT(price, rate)
price + rate
ENDPROCEDURE
It is better because it is easier.
Why this is weak:
- uses a procedure when a returned value is needed
- does not actually return anything
- the calculation is unclear or incorrect
- the advantage is too vague for high marks
Follow-up teaching point
A useful follow-up question is: How do you know this must be a function and not a procedure? Students who answer “because the result needs to be sent back to the calling code” usually understand the heart of the topic.
Practice Questions
Define a subroutine. 2 marks
Marking guidance: 1 mark for identifying it as a named block of code. 1 mark for recognising it performs a specific task or can be called from elsewhere.
State two advantages of using subroutines in a program. 2 marks
Marking guidance: reward any two from reuse, readability, easier testing, easier debugging, or easier maintenance.
Explain the difference between a procedure and a function. 3 marks
Marking guidance: reward the distinction that a function returns a value, while a procedure performs a task without returning one.
Write a function with two parameters that returns the larger of two numbers. 4 marks
Marking guidance: reward function structure, two parameters, correct comparison, and valid return value.
A student says, “Parameters are the answers a function gives back.” Explain why this is incorrect. 3 marks
Marking guidance: reward explanation that parameters are inputs passed in, while the returned value is sent back out.
Why does using subroutines make debugging easier? 3 marks
Marking guidance: reward the idea that smaller sections can be tested separately and faults can be isolated more easily.
🎯 Exam technique tip: when students are asked for advantages, they should explain the benefit. “Reusable” alone is thinner than “Reusable, so the same code does not need to be rewritten and updates only need to be made once.”
Common Misconceptions
| Misconception | Quick correction |
|---|---|
| A procedure and a function are basically the same thing. | They are both subroutines, but a function returns a value and a procedure does not. |
| Parameters are outputs. | No. Parameters are values passed into the subroutine. Outputs or return values come back out. |
| Subroutines are only useful in very long programs. | Even short programs become clearer when repeated or separate tasks are placed in subroutines. |
| The only advantage is saving time while typing. | They also improve readability, testing, debugging, and maintenance. |
| If a function is written correctly, it does not matter whether the return value is used. | The returned value still needs to be stored, printed, or used elsewhere, or the function call achieves very little. |
| Structured programming just means tidy layout. | Tidy layout helps, but structured programming is really about logical organisation and decomposition into manageable parts. |
FAQ
How much detail do students need about subroutines for AQA GCSE?
Students need secure understanding of what subroutines are, why they are useful, how parameters pass data in, and how functions return values. They do not need a university lecture on software architecture. Clear GCSE-level precision is the aim.
Should I teach procedures before functions?
Usually yes. Procedures are often easier to grasp first because students can focus on the idea of a named task before handling returned values.
Do students need to use more than one parameter?
Yes. AQA expects students to be able to use subroutines that require more than one parameter, so this should appear in examples and practice.
What is the most common weakness in exam answers on this topic?
Students often know that subroutines reduce repetition, but they do not explain the wider benefits clearly enough, or they mix up parameters and return values.
How can I quickly check whether students understand functions properly?
Ask them to identify what goes in, what happens inside, and what comes back out. If they can explain those three stages clearly, they usually have a workable model of how functions behave.
What is a reliable retrieval question for this topic?
Try: “Why must this be a function rather than a procedure?” It reveals very quickly whether students really understand return values or are just nodding hopefully.
Make feedback on subroutines quicker
Marking.ai can help teachers review programming responses faster, spot where students are muddling parameters and return values, and give sharper feedback on what strong structured programming answers actually look like. It is especially useful when the class has managed to produce six different versions of the same mistake with remarkable creativity.