Sub-systems, and inputs, processes, outputs and storage
A system is a set of parts that work together to do a job. Each part is a sub-system. A sub-system can be split again until each part is small enough to code easily.
Example: a supermarket self-checkout is a system. Scanning, weighing, payment and printing the receipt are its sub-systems.
Every problem can also be decomposed into four parts.
Inputs: the data going in. Processes: what is done to the data. Outputs: the results that come out. Storage: data that must be kept for later.
?Why?Small parts are easier to write, test and fix. Different programmers can work on different sub-systems at the same time.
!Watch outDo not put the same thing in two places. 'Total' is calculated (process) and then shown (output). Say which one you mean.
Structure diagrams
A structure diagram shows how a system is broken down into sub-systems. The whole system is in the top box.
Each level below shows smaller parts. Read it top to bottom. Boxes on one level are usually read from left to right.
It shows what the parts are, not the order of every step or the decisions.
?Why?A structure diagram is a picture of decomposition. It helps a team share out the work: one person can code 'Take payment' while another codes 'Update card'.
There is a diagram for this step in the IGCSE library.
Flowcharts: the six symbols
A flowchart shows the steps of an algorithm as shapes joined by arrows. Each shape has one meaning.
Follow the flow lines from START to STOP. A decision diamond has two exits, labelled Yes and No.
A loop is drawn as a flow line that goes back up to an earlier step.
e.g.ExampleFlowchart to count passes in 6 marks:
START (terminator)
→ Count ← 0, Index ← 1 (process)
→ INPUT Mark (input/output)
→ Mark >= 25? (decision) Yes → Count ← Count + 1 (process); No → go on
→ Index ← Index + 1 (process)
→ Index > 6? (decision) No → back up to INPUT Mark; Yes → go on
→ OUTPUT Count (input/output)
→ STOP (terminator)
!Watch outUse the right shape. INPUT and OUTPUT go in a parallelogram, not a rectangle. Every decision diamond needs two labelled exits.
There is a diagram for this step in the IGCSE library.
Pseudocode: Cambridge's planning language
Pseudocode is a way of writing an algorithm that looks like code but is not tied to one language.
Cambridge has its own rules. Keywords are in CAPITALS. Assignment uses `←`. Comments start with `//`. Not equal is `<>`.
Paper 2 answers must be in pseudocode. Program code only earns marks in the 15-mark scenario question.
DECLARE Mark : INTEGER
OUTPUT "Enter your mark: "
INPUT Mark
IF Mark >= 25
THEN
OUTPUT "Pass"
ELSE
OUTPUT "Fail"
ENDIFmark = int(input("Enter your mark: "))
if mark >= 25:
print("Pass")
else:
print("Fail")?Why?Pseudocode lets you think about the logic without worrying about the exact rules of Python. An examiner can read it whatever language you learned.