GCSE · Computer Science · AQA · Spec 8525
Advantages of subroutines
Your quiz game's menu says 'Qiut'. Quick: how many places do you have to fix? If your gut says 'just one', you've already met the big idea of this lesson.
Computer Science · Subroutines
Which advantage is it?
Pick a situation, then drop it under the advantage it shows. Right or wrong, you'll get the reason, so commit before you peek.
Still to sort
Code reuse (0)
Written once, called as many times as needed, so no repeated lines.
Where the line is: Reuse means not writing the same lines again. If the story is about changing code later, that's Maintenance.
Decomposition (0)
A big problem broken into smaller sub-problems, one subroutine each.
Where the line is: Decomposition is breaking the problem down to design it. Sharing those parts out between people is Teamwork.
Testing and debugging (0)
One part checked on its own, so an error has fewer places to hide.
Where the line is: This is about finding errors. A correction then reaching every call is Maintenance.
Maintenance (0)
A correction or improvement made once takes effect at every call.
Where the line is: Maintenance is a change made later. Not having to type the lines in the first place is Code reuse.
Readability (0)
The main program reads like a list of clearly named steps.
Where the line is: Readability is about a person reading the program. Breaking the problem down to plan it is Decomposition.
Teamwork and libraries (0)
Programmers share out the work, or a tested subroutine goes on to other programs.
Where the line is: Calling a subroutine many times in ONE program is Code reuse. Using it in OTHER programs, from a library, belongs here.
Six advantages, eight situations. Some advantages get two situations and some get one, so don't expect the columns to fill evenly.
Maintenance
Reason it through
Why does one fix inside show_menu correct the menu everywhere in the program?
First link · your turn
Where does the code for showing the menu actually live?
Decomposition, teamwork and libraries
View
Layers
Explore
step through the views →
One big problem: a whole quiz game. Designing it in one go would mean holding every detail in your head at once. Not fun.
Step through the four views, then tap any box to see what it's doing there.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Write a task once, in one named place, and a whole list of problems quietly goes away.
What you need to know
- A subroutine is a named, self-contained block of code that does one task. It only runs when the program calls it.
- Here's the root of nearly every advantage: the task's code is written once, in one named place.
- Code reuse: write the lines once, call them whenever you need them. Shorter program, and no mistakes copied around.
Have a goSam pasted the same 6-line score display into 10 places in his game, 'to be safe'. Counting only working lines and calls, how many lines would a subroutine version need?
16: the 6 lines once, inside the subroutine, plus 10 one-line calls (instead of 60).
The lines are written once and each place just calls them. Answering 60 counts every pasted copy, which is exactly the repetition the subroutine removes.
- Decomposition: a big problem splits into smaller sub-problems, one subroutine each, and every piece is simpler to design and write.
- Testing and debugging: try each subroutine on its own first. If something breaks, the error is trapped in a small section.
Have a goRhys runs his check_postcode subroutine on its own with a few test postcodes, and it gives a wrong answer. Before looking at anything else, where must the fault be?
Somewhere in check_postcode's own few lines.
Nothing else in the program ran during that test, so the error is isolated to that small section. Hunting through the whole program would ignore what the test just told him.
- Maintenance: fix or improve the code once, inside the subroutine, and every call picks up the change.
- Readability: well-named calls turn the main program into a short list of steps, minus the detail of each.
Have a goYour friend names every subroutine do_stuff1, do_stuff2, do_stuff3. In a bus-fare program, suggest a better name for the one that works out the fare, and say why it helps.
Something like calculate_fare(): the name says what the step does.
Readability comes from names that describe the task. A name like do_stuff2 hides it, so the reader has to dig into the detail to find out what the step is for.
- Teamwork and libraries: different programmers can write separate subroutines at once, and a well-tested one can serve other programs.
- Faster running isn't the point. The wins are in how a program gets written, tested and maintained.
- Called just once? Still worth it, because readability, decomposition and testing don't need any repetition.
The big picture
A subroutine is a named, self-contained block of code that does one task and runs when it is called. Because each task is written once, in one place, subroutines bring six advantages: code reuse, decomposition, testing and debugging, maintenance, readability, and teamwork and libraries. They make a program easier to write, test and maintain, not faster to run, and they help even when a subroutine is called only once.
Key points
Worked example
Problem
A cinema-booking program checks that a seat number typed in is valid, and it does this in five different places. Explain two advantages of putting the seat check in a subroutine.
⚠ Watch out
Saying subroutines make a program "easier" or "faster". Sounds right; scores nothing. "Easier" names no advantage: say which one, and what it makes easier. "Faster" isn't the reason at all. The advantages are about writing, testing and maintaining code, even for a subroutine called only once.
Memory hook
Really Determined Testers Maintain Readable Libraries: Reuse, Decomposition, Testing, Maintenance, Readability, Libraries (and teamwork). Underneath all six: one task, written once, in one named place.
Check yourself
Cover the page. Name all six advantages of subroutines and give a one-line reason for each. Then explain why a subroutine that is called only once can still be worth writing.
Flashcards
(11)What is a subroutine?
The one fact behind almost every advantage of subroutines
Code reuse
Decomposition
Testing and debugging
Maintenance
Readability
Teamwork
Libraries
Do subroutines make a program run faster?
Is a subroutine worth writing if it's called only once?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 28 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.