Community resourceWorksheet

OCR H446 2.2.1 Modularity, functions and procedures

Part 6 of 14 · H446 2.2.1 · Programming techniques

H446 2.2.1 treats modularity as design, not simply as splitting code up. A sports-results service is decomposed here into validation, calculation and display, so each subprogram carries one responsibility and a stated interface, and students can defend the split using OCR's function and procedure terminology.

Students will:

  • decompose a longer program into subprograms with coherent responsibilities
  • state the inputs, returned values and side effects of each subprogram
  • distinguish a function from a procedure as OCR defines them
  • implement a calculating function and a display subprogram with clear interfaces
  • explain how the decomposition improves both testing and maintenance

Inside: 6 explanation cells, 1 multiple-choice question, 1 fill-in-the-blanks cell, 3 written answers and 2 Python tasks. 23 marks, about 25 to 35 minutes.

Series: H446 2.2.1 · Programming techniques, part 6 of 14.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 30 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 3 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Modularity, functions and procedures

A sports-results service becomes easier to reason about when validation, calculation and display have separate responsibilities.

By the end, you will be able to

  • decompose a larger task into coherent modules
  • name inputs, outputs and side effects
  • distinguish OCR functions from procedures
  • link modularity to testing, reuse and maintenance

Reactivate: parameters and returned values.

Worked responsibility and interface model

A module groups a coherent responsibility. Parameters carry inputs into a subprogram. In OCR terminology, a function returns a value while a procedure performs a task without returning a value for use in an expression. Python functions with no explicit return produce None, but the OCR conceptual distinction still matters.

For the results service:

  • calculatePoints has one responsibility: calculate. Its interface is wins, draws → points, so it is a function.
  • displaySummary has one responsibility: present. Its interface is team, points → visible output, so it is a procedure.

Because calculation is separated from display, a test can call calculatePoints with known inputs and compare the returned value without capturing screen output.

Worked interface model

wins, draws → calculate_points → returned points
points → display_report → visible output

calculate_points is a function because the caller uses its returned value. display_report is a procedure in OCR’s conceptual model because its purpose is the side effect of display.

Use a three-part module test: one responsibility; explicit inputs; one returned result or named side effect. If a proposed module validates, calculates and formats, it probably needs further decomposition.

Multiple choice1 mark

Which subprogram is most clearly a function in OCR terminology?

  • AA subprogram that prints a banner
  • BA subprogram that clears a display
  • CA subprogram that pauses until input
  • DA subprogram that returns points calculated from a score
Worked example
def report(wins, draws):
    if wins < 0 or draws < 0:
        print("Invalid")
    else:
        points = wins * 3 + draws
        print("Points:", points)
Written answer6 marks

Propose three coherent subprograms for the supplied report code. For each, state its responsibility and any input or returned value.

Separate validation, calculation and presentation.

Students type their answer here.

Build reusable interfaces

Write calculate_points(wins, draws) to return the points. Write display_summary(team, points) to print one line containing both values.

Coding task5 marks
def calculate_points(wins, draws):
    pass

def display_summary(team, points):
    pass
Written answer3 marks

Write the display part as an OCR ERL procedure named displaySummary that receives team and points and prints both on one line.

Use a procedure because the purpose is the visible output, not a returned value.

Students type their answer here.

Written answer4 marks

Explain how this decomposition can improve both testing and maintenance.

Link each benefit to one of the separated responsibilities.

Students type their answer here.

Checkpoint

Complete the modular-design summary from memory. There is no answer bank, and correctness is withheld until teacher review.

Fill in the blanks4 marks
A program split into coherent parts is checkpoint gap 1. Parameters and returned values form a module checkpoint gap 2. In OCR terminology, a checkpoint gap 3 returns a value, while a checkpoint gap 4 performs a task without returning one.

Review your understanding

Before submitting, check that you can explain the main distinction in your own words, apply it in an unfamiliar context and justify the resulting behaviour or consequence.