GCSE · Computer Science · AQA · Spec 8525

Advantages of structured approach

A program that says 'jump to line 240' every few lines is a nightmare to fix. That tangle is called spaghetti code, and here is the cure.

Computer Science · Structure

Structure chart: a grade-report program (invented example)

Tap a box to see its one task and its interface.

Tap any part of the diagram to see what it does.

Same job, two styles

Go-to style programvsStructured program

Compare a typical go-to style program with a structured one, row by row.

Focus

How the flow is controlled

Go-to style program

go-to statements make the program jump from one place to another

Structured program

selection (if, elif, else) and loops (while, for)

The insight

Structured programming swaps the jumps for selection and loops.

How easy it is to follow

Go-to style program

too many go-to jumps make the code messy and hard to follow

Structured program

small sections are easier to read and check than one huge program

How it is organised

Go-to style program

often one very large program

Structured program

a main program that calls named subroutines, each doing one specific task

Computer Science · Algorithms

Trace table — dry run the code

Step through one subroutine being called twice, and watch what goes in and what comes back.

1SUBROUTINE find_percent(mark, total)
2 result <- mark / total * 100
3 RETURN result
4ENDSUBROUTINE
5first <- find_percent(18, 24)
6second <- find_percent(9, 20)
mark
total
result
first
second
Press Start to run the first line.
·

Ready when you are — step through one line at a time.

Computer Science · Structured programming

Which advantage is it?

Which advantage of a structured approach does this scenario show?

Still to sort

Readability (0)

Reading and checking small sections.

Where the line is: It is about reading a section, not about running tests on it or changing it.

Testing (0)

Checking that a section works, and finding mistakes in it.

Where the line is: It is about checking and finding mistakes, not about changing a program that already works.

Maintenance (0)

Changing a program that already exists.

Where the line is: It is about updating without breaking the rest, not about finding mistakes in new code.

Development time (0)

Getting a large program built sooner.

Where the line is: It is about several people building at once, not about reusing code that is already written.

Reuse (0)

Calling the same subroutine again and again.

Where the line is: It is about calling existing code many times, not about several people writing different code.

8 of 8 still to sort.

Each scenario below shows one of the five advantages. Choose the box you think it belongs in before you read why.

Development time

Which idea sounds like yours?

A team builds a big program out of subroutines, and the project is finished sooner than it would have been otherwise.

Which idea is closest to why the development time came down?
How sure are you?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Why splitting a program into named subroutines makes it easier to read, test, change, share out and reuse

What you need to know

  • Structured programming controls flow with selection (if, elif, else) and loops (while, for), not go-to statements.
  • Too many go-to jumps made code messy and hard to follow, so it was nicknamed spaghetti code.
  • Have a goJo swears that spaghetti code means a program that has gone cold and sticky. What is the nickname really about?

    Too many go-to statements made the code messy and hard to follow.

    The name describes the tangle of jumps that is hard to follow, not anything to do with how a program is cooked or run.

  • In a structured approach, a program is decomposed into smaller sections called subroutines, and the main program calls them.
  • A subroutine is a sequence of instructions with an identifiable name that performs one specific task.
  • A structure chart plans the hierarchy: the main program is the top box, with a box for each subroutine beneath it.
  • A subroutine's interface is its identifier (a meaningful name), its parameters (values passed in) and its return value (value passed back).
  • Have a goA subroutine called count_words takes in a sentence and passes back how many words it has. Name its identifier, its parameter and its return value.

    Identifier: count_words. Parameter: the sentence. Return value: the number of words.

    The parameter is the value that goes in, and the return value is the value that comes back to the main program.

  • Readability: it is easier to read and check small sections of code than one very large program.
  • Testing: a single-task subroutine is easier to test, and less code in each section makes mistakes easier to find and fix.
  • Maintenance: a change can be made and tested in one place without affecting the rest of the program.
  • Have a goA date-formatting subroutine in a structured program needs changing. Where does the change get made and tested?

    In that one subroutine, in one place.

    The change can be made and tested in one place without affecting the rest of the program, so the main functions are not disrupted.

  • Development time and reuse: a team can build subroutines at the same time, and a subroutine can be called many times.

The big picture

A structured program controls its flow with selection and loops instead of go-to statements, and it is divided into named subroutines that a main program calls. A structure chart plans that layout, and the layout is what makes the program easier to read, test, maintain, build as a team and reuse.

Key points

1Structured programs use selection and loops instead of go-to statements, and are split into subroutines.
2A structure chart has the main program at the top and one box per subroutine beneath it.
3A subroutine's interface is its identifier, its parameters and its return value.
4The five advantages are readability, testing, maintenance, development time and reuse.

Worked example

Problem

A shop's structure chart has a subroutine total_cost(price, quantity) that hands back the cost of an order. State its identifier, its parameters and its return value, then say what the main program receives when it calls total_cost(4, 3). (In this invented example, the subroutine multiplies price by quantity.)

⚠ Watch out

Thinking a structured approach is about making the finished program run faster. The five advantages are gains for the programmers: easier reading, testing, maintenance, team development and reuse.

🧠

Memory hook

Read it, Test it, Mend it, Share it, Reuse it. Mend is maintenance and Share is development time, because the work gets shared between programmers.

✓

Check yourself

A team is building a large program. Which advantage does it show when each programmer takes a different subroutine and they all write them at the same time?

Flashcards

(13)
What does structured programming use to control the flow of a program?
Selection statements (such as if, elif, else) and loops (such as while and for), instead of go-to statements.
Why is heavy go-to code nicknamed spaghetti code?
Too many go-to statements made code messy and hard to follow.
What does it mean to decompose a program?
Divide it into smaller sections called subroutines, which the main program calls.
What is a subroutine?
A sequence of instructions with an identifiable name that performs one specific task.
What does a structure chart show?
The hierarchy of a structured program: the main program in the top box and a box for each subroutine beneath it, each handling one part of the task.
What is the interface of a subroutine?
How data is passed in and out of it: the identifier, the parameters and the return value.
What is a parameter?
A value that must be passed into a subroutine.
What is a return value?
The value a subroutine passes back to the main program.
Readability: why is a structured program easier to read?
It is easier to read and check small sections of code than one very large program.
Testing: why does a structured approach help?
A subroutine that carries out a single task is easier to test, and less code in each section makes mistakes easier to find and fix.
Maintenance: what does a structured approach allow?
A change can be made and tested in one place without affecting the rest of the program, so it can be updated without disrupting its main functions.
Development time: how does a structured approach speed things up?
A large program can be shared between a team, so subroutines are developed at the same time (concurrently).
Reuse: what does a subroutine save you from?
Repeating the same code or using go-to statements, because a subroutine can be called many times.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

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 24 November 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.