Menu

Structure Diagrams

Structure Diagrams

A structure diagram shows a problem that has been broken down into smaller parts. The whole problem sits in a single box at the top, and everything it is made of sits on the levels underneath.

The levels

Each level below the top box holds the subsections of the box directly above it. Any subsection can be broken down again, so the level below that holds its smaller tasks. This carries on until every box is small enough to be written as one sub program or just a few lines of code.

PositionWhat it holds
Top boxThe whole problem
Next level downThe main subsections the problem is made of
Levels below thatSmaller and smaller tasks belonging to the box above

The top box is the whole problem, not the first step the program carries out. Nothing here says what happens first, because that is not what the diagram is for.

Lines and links

Boxes are rectangles joined by straight lines, so the shape widens towards the bottom. A line means the lower box is part of the box it is joined to. Boxes are joined only to their parent, never across to each other, so every task can be traced back up to the problem it belongs to.

For example, a program that waters a greenhouse could have Water the plants in the top box. Joined to it on the level below sit Check how dry the soil is and Give the plants a drink. Give the plants a drink is broken down once more, giving Open the valve, Wait 30 seconds and Close the valve on the next level, each joined only to Give the plants a drink.

Structure diagram of a science museum trip split into transport, cost, permission letters and lunch, with transport split again into how many coaches are needed, cost of hiring one and pick-up time.

Practise this

OCR GCSE Computer Science · Structure Diagrams