Pearson Edexcel · GCSE · Computer Science
Course version: 1CP2 · Version from Sept 2020
Understand the benefits of using subprograms
Full specification wording
Decomposition and abstraction: 1.1.2 understand the benefits of using subprograms
A subprogram is a named block of code that performs one task and can be called whenever that task is needed.
Checked against the Pearson Edexcel 1CP2 specification (opens in a new tab) on .
- Point 2 of 2
- 4 key terms
Study notes
From the checked teaching notes for this specification point.
The idea
A subprogram is a named block of code that performs one task and can be called whenever that task is needed. It may take parameters and may return a value. The benefits follow from decomposition: a large program is split into smaller, self-contained parts, so each part is easier to write, read, test and debug. A subprogram that works correctly can be reused many times instead of rewriting the same code, which shortens programs and reduces the chance of inconsistent errors. If a fault is found, it can be fixed once inside the subprogram rather than in every copy. Teams can also divide work by assigning different subprograms to different programmers, and a well-named subprogram makes the overall program easier to follow.
What earns the marks
- A subprogram is a named block of code that carries out a specific task and can be called when required.
- Subprograms make a program easier to read and understand because each one has a single clear purpose.
- Code can be reused by calling the same subprogram many times instead of rewriting it.
- Testing and debugging are easier because each subprogram can be checked in isolation.
- A fault fixed once inside a subprogram is corrected everywhere it is called.
- Subprograms support teamwork, since different people can develop different parts of a program.
Common mistakes and how to put them right
Saying subprograms make a program run faster.
Put it right: The main benefits are readability, reuse, easier testing and easier maintenance, not guaranteed speed.
Thinking a subprogram must always return a value.
Put it right: Some subprograms perform an action and return nothing; returning a value is optional.
Believing reuse means copying the code into each place it is needed.
Put it right: Reuse means calling the same subprogram, so the code exists only once.
Assuming subprograms remove the need to test.
Put it right: Each subprogram still needs testing, but it can be tested separately before being combined.
Exam tips
- Link each benefit to a concrete effect, such as fixing one fault in one place instead of many.
- Use the scenario in the question to name a task that could become a subprogram.
- If asked for benefits, give distinct points rather than repeating the same idea in different words.
Try the lesson
The start of the Decomposition and abstraction: 1.1.2 understand the benefits of using subprograms lesson, made from checked teaching notes for this specification point.
Have a go first
A shop program calculates sales tax in 14 separate places by copying the same 6-line calculation each time. Why does writing the calculation once as a subprogram help a programmer who needs to change the tax rule?
Listen
A subprogram is a named block of code that performs one task and can be called whenever that task is needed. It may take parameters and may return a value. The benefits follow from decomposition: a large program is split into smaller, self-contained parts, so each part is easier to write, read, test and debug. A subprogram that works correctly can be reused many times instead of rewriting the same code, which shortens programs and reduces the chance of inconsistent errors. If a fault is found, it can be fixed once inside the subprogram rather than in every copy. Teams can also divide work by assigning different subprograms to different programmers, and a well-named subprogram makes the overall program easier to follow. A strong answer earns marks for these points. A subprogram is a named block of code that carries out a specific task and can be called when required. Subprograms make a program easier to read and understand because each one has a single clear purpose. Code can be reused by calling the same subprogram many times instead of rewriting it. Testing and debugging are easier because each subprogram can be checked in isolation. A common slip: Saying subprograms make a program run faster. Instead, the main benefits are readability, reuse, easier testing and easier maintenance, not guaranteed speed. Exam tip: Link each benefit to a concrete effect, such as fixing one fault in one place instead of many.
See it
Key words
Say what each word means before you turn the card.
Subprogram
Try answering aloud or in your head before turning the card.
Reuse
Try answering aloud or in your head before turning the card.
Testing and debugging
Try answering aloud or in your head before turning the card.
Teamwork
Try answering aloud or in your head before turning the card.
See every definition
- Subprogram
- A named block of code that performs one task and can be called whenever that task is needed.
- Reuse
- Calling the same subprogram many times instead of rewriting the same code, which shortens programs and reduces the chance of inconsistent errors.
- Testing and debugging
- Easier because each subprogram can be checked in isolation, and a fault found can be fixed once inside the subprogram rather than in every copy.
- Teamwork
- Supported because teams can divide work by assigning different subprograms to different programmers.
Label the diagram
Some boxes have lost their names. Pick the right name for each number.
1Box 1
2Box 2
3Box 3
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Decomposition and abstraction: 1.1.2 understand the benefits of using subprograms
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge