GCSE · Computer Science · AQA · Spec 8525
Structured approach to programming
Picture one giant block of code doing everything, with no clue where each job starts or ends. Now picture a few small, named jobs instead. Which would you rather fix?
Computer Science · Structure
One program, broken into small jobs
This is a structure chart for a program that marks a quiz. Tap each box. On the lines, ↓ means a value handed in and ↑ means a value sent back.
Tap any part of the diagram to see what it does.
Computer Science · Subroutines
Watch the program leave, then come back
calculate_percentage from the chart, now as real code. It is written at the top, but watch when it actually runs.
Predict first: when you reach line 6, which line do you think runs next?
1 def calculate_percentage(score, total):2 percentage = score / total * 1003 return percentage4 # main program5 mark = 156 result = calculate_percentage(mark, 20)7 print(result)
Variables
Output
Step 1: The def line tells the program that calculate_percentage exists. The indented lines under it are skipped for now: none of that code has run.
Keep your eye on the highlighted line: it jumps up to the subroutine, then drops back into the main program.
Computer Science · Why bother?
Spot the advantage
A team is building the quiz marker. Each moment below shows one advantage of the structured approach. Put each one under the advantage it shows.
Still to sort
Easier to read and understand (0)
The code is split into small, manageable sections.
Easier to test (0)
Each subroutine carries out one task, so errors are easier to find and fix.
Where the line is: Testing is about FINDING and fixing a fault. Maintenance is about making a change later without breaking the rest.
Easier to maintain (0)
A change is made and tested in one place without affecting the rest of the program.
Where the line is: If the program is being changed on purpose, not hunted for a bug, it is maintenance.
Faster development (0)
Several programmers can work on different subroutines at the same time.
Where the line is: Faster development is about PEOPLE working in parallel, not about one subroutine being used again.
Reuse (0)
A subroutine can be called many times, so the same code is not written out again.
Where the line is: Reuse is about CALLING the same subroutine again, not about sharing the work out.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Split one big job into small named jobs, plan them on a chart, and call each one when you need it.
What you need to know
- A structured approach decomposes a program into smaller subroutines, each designed to do one specific task.
- A subroutine is a named sequence of instructions that performs a specific task. It is out-of-line code: it runs only when it is called.
- Before coding, subroutines are planned on a structure chart: the main program at the top, the subroutines beneath it.
- Each subroutine's interface is its identifier, its parameters (values passed in) and its return value (value passed back).
- Structured code uses sequence, selection and iteration instead of goto, and has one entry point and one exit point.
The big picture
The structured approach breaks a program into small subroutines that each do one specific task. They are planned on a structure chart, each has a clear interface (identifier, parameters, return value), and they run only when the main program calls them. Structured code uses sequence, selection and iteration instead of goto, and has one entry point and one exit point. This makes programs easier to read, test and maintain, faster to develop, and lets code be reused.
Key points
Worked example
Problem
This loop keeps asking for a password until the right one is typed: while True: guess = input("Password: ") if guess == "open123": break Explain why the loop is not properly structured, then rewrite it so that it is.
⚠ Watch out
Thinking a program runs from top to bottom, so the subroutine written at the top runs first. It does not: a subroutine is out-of-line code that runs only when the main program calls it, and then control comes back to the line that made the call.
Memory hook
Plan it like a family tree, run it like a phone call. The chart shows who belongs under whom; when the program runs, main rings a subroutine, hands over the details, waits, and gets an answer back before carrying on.
Check yourself
Cover the page. Name the three parts of a subroutine's interface and say which one carries a value back. Then say why while True with a break inside is not properly structured.
Flashcards
(14)What is the structured approach to programming?
What is a subroutine?
What does 'out of line' mean for a subroutine?
A subroutine is written at the top of a program. Does it run first?
On a structure chart, what does the top box show? What do the boxes beneath it show?
When is a structure chart drawn?
What does a subroutine's interface determine?
Interface: what is the identifier?
Interface: what are the parameters?
Interface: what is the return value?
Which three structures control the flow in structured programming?
What is spaghetti code?
How many entry and exit points does a properly structured program have?
Five advantages of the structured approach?
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 30 September 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.