TopMyGrade

GCSE/Computer Science/AQA

CS2.10Structured programming and structured programming techniques: top-down design, modularity, abstraction, decomposition

Notes

Structured programming techniques

Structured programming is an approach to writing software that makes programs easier to understand, test and maintain. AQA GCSE expects you to understand four core techniques: top-down design, modularity, abstraction and decomposition.

Top-down design

Top-down design starts with the overall problem and breaks it into smaller, more manageable sub-problems — then breaks those down further until each piece is small enough to code directly.

Example — a quiz game broken down:

Quiz Game
├── Initialise game (set score to 0, load questions)
├── Play round
│   ├── Display question
│   ├── Get user answer
│   └── Check answer and update score
└── Display final score and grade

Each box eventually becomes a subroutine (procedure or function).

Decomposition

Decomposition is the process of splitting a complex problem into smaller, simpler sub-problems that can each be solved independently. It is essentially what top-down design does at each level.

A problem is fully decomposed when each part:

  • Has a single, clear purpose
  • Can be implemented and tested in isolation
  • Fits in one screen of code (roughly)

Modularity

Modularity means organising code into separate, self-contained modules (subroutines, classes, files). Each module:

  • Does one thing well (single responsibility)
  • Has a clear interface (parameters in, return values out)
  • Can be developed and tested independently

AQA pseudocode — modular quiz:

SUBROUTINE displayQuestion(questionText)
  OUTPUT questionText
ENDSUBROUTINE

SUBROUTINE getAnswer()
  USERINPUT answer
  RETURN answer
ENDSUBROUTINE

SUBROUTINE checkAnswer(userAnswer, correctAnswer)
  IF userAnswer = correctAnswer THEN
    RETURN TRUE
  ELSE
    RETURN FALSE
  ENDIF
ENDSUBROUTINE

Benefits of modularity:

  • Reuse — a sorting subroutine can be called from many parts of the program
  • Team working — different programmers can build different modules simultaneously
  • Easier testing — test each module in isolation before combining
  • Easier maintenance — fixing a bug in one module doesn't require changing others

Abstraction

Abstraction means hiding unnecessary detail so that the programmer (or user) can focus on what matters at a given level.

Two flavours at GCSE:

TypeWhat's hiddenExample
Procedural abstractionImplementation of a subroutinesortList(myList) — caller doesn't need to know if it uses bubble or merge sort
Data abstractionInternal representation of dataUsing score as a variable; the bit pattern in RAM is irrelevant

Abstraction is what makes top-down design work: at the top level you write playRound() without worrying about the details inside that subroutine.

How the techniques fit together

  1. Decompose the problem into smaller chunks.
  2. Design top-down — major modules first, details later.
  3. Implement each chunk as a separate module (subroutine).
  4. Use abstraction so each module's caller ignores internal details.

Real benefit: A 5,000-line program broken into 50 subroutines of ~100 lines each is far easier to debug, extend and hand to another developer than 5,000 lines of sequential code.

Common exam question angle

Examiners often ask you to:

  • State one benefit of using subroutines (modularity / reuse / easier testing)
  • Identify where abstraction is being used in a given program
  • Draw or extend a structure chart (top-down decomposition diagram)

AI-generated · claude-opus-4-7 · v3-deep-computer-science

Practice questions

Try each before peeking at the worked solution.

  1. Question 12 marks

    Benefits of modular programming

    Give two benefits of using subroutines when writing a large program.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  2. Question 26 marks

    Decomposition

    A student is writing a program to manage a school library. Decompose the main problem into three sub-problems. For each, state one further sub-task.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  3. Question 33 marks

    Abstraction in subroutines

    A programmer calls sortList(scores) and doesn't know whether bubble sort or merge sort is used inside. What programming technique does this illustrate? Explain your answer.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  4. Question 43 marks

    Top-down design

    Explain what is meant by top-down design and state one advantage of this approach.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  5. Question 53 marks

    Identifying modularity

    A program to run a bank uses separate subroutines: login(), checkBalance(), deposit(amount), withdraw(amount), logout(). Explain how this demonstrates modularity.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  6. Question 64 marks

    Structure chart

    A student decomposes a "Book Quiz" program into: Load Questions, Run Quiz (which contains: Show Question, Get Answer, Check Answer), Show Score. Draw a structure chart to represent this hierarchy. Describe what your chart shows.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

Flashcards

CS2.10 — Structured programming and structured programming techniques

11-card SR deck for AQA GCSE Computer Science topic CS2.10

11 cards · spaced repetition (SM-2)