7.2 Computer systems, sub-systems and decomposition

← Topic 7.1 Program development life cycleComputer Science contentsTopic 7.3 Explaining the purpose of an algorithm →
Chapter 7 · Algorithm design and problem solving

7.2 Computer systems, sub-systems and decomposition

Large computer systems become easier to understand and develop when they are broken into smaller sub-systems. Topic 7.2 explains top-down design, stepwise refinement, input-process-output-storage decomposition, structure diagrams, flowcharts and Cambridge-style pseudocode.

Top-down designStepwise refinementStructure diagramsFlowchartsPseudocode
7.2.1

The computer system and its sub-systems

A computer system is made up of software, data, hardware, communications and people. A system can be divided into sub-systems, and each sub-system can be divided again until each part performs a single action.

Top-down design means starting with the whole system and decomposing it into smaller sub-systems. Repeatedly breaking those sub-systems down into smaller parts is called stepwise refinement.

This modular approach makes complex systems easier to understand, develop and test. On large projects, different programmers can work on separate sub-systems at the same time, reducing development and testing time. Each sub-system can be implemented as a subroutine, with its logic represented using flowcharts or pseudocode.

Exam distinction: top-down design is the overall decomposition approach; stepwise refinement is the repeated process of breaking each part into smaller parts until each performs a single action.
Check top-down design and sub-systems.
7.2.2

Decomposing a problem

Any computer-system problem can be decomposed into four component types:

ComponentMeaning
InputsData entered while the system is active.
ProcessesTasks performed using input data and any previously stored data.
OutputsInformation displayed or printed for users.
StorageData saved on an appropriate medium for future use.

Textbook example: alarm app

  • Inputs: set an alarm time, remove an alarm time, switch an alarm off, press snooze.
  • Processes: compare current time with alarm time, store/remove alarm times, manage snooze.
  • Outputs: sound or tune when the alarm or snooze time is reached.
  • Storage: the alarm time or times that have been set.
Check input, process, output and storage.
7.2.3

Methods used to design and construct a solution to a problem

The textbook identifies three formal methods that Cambridge IGCSE Computer Science students need to use: structure diagrams, flowcharts and pseudocode.

Structure diagrams

A structure diagram shows top-down design in hierarchical form. Each lower level gives a more detailed breakdown of the system.

Figure 7.2 Basic structure diagram
Figure 7.2 Basic structure diagram
Figure 7.3 Structure diagram for alarm app
Figure 7.3 Structure diagram for alarm app

Flowcharts

A flowchart shows the steps needed to complete a task and the order in which they are carried out. These ordered steps form an algorithm.

Figure 7.4 Flowchart for check time sub-system
Figure 7.4 Flowchart for check time sub-system

Standard flowchart symbols

Cambridge flowcharts use standard symbols for start/end, processes, input/output, decisions and flow lines.

Figure 7.5 Terminator symbols
Figure 7.5 Terminator symbols
Figure 7.6 Process symbols
Figure 7.6 Process symbols
Figure 7.7 Input and output symbols
Figure 7.7 Input/output symbols
Figure 7.8 Decision symbol
Figure 7.8 Decision symbol
Figure 7.9 Flow line
Figure 7.9 Flow line

Decision symbols always have two labelled outputs. Flow lines use arrows to show the direction of control, usually top-to-bottom and left-to-right.

Figure 7.10 Flowchart for ticket cost calculator
Figure 7.10 Flowchart for ticket cost calculator

Pseudocode

Pseudocode describes an algorithm using English-like keywords similar to a high-level language, but without the strict syntax rules of a real programming language. In the textbook, keywords such as INPUT, OUTPUT, IF and WHILE are capitalised, data item and subroutine names start with a capital letter, and nested/repeated statements are indented.

Assignment and mathematical operators

The assignment operator gives a variable the value of the expression on the right. Mathematical operators include +, , *, /, ^ and parentheses.

Cost ← 10
Price ← Cost * 2
Tax ← Price * 0.12
SellingPrice ← Price + Tax

Conditional statements

IF … THEN … ELSE … ENDIF selects between true and false paths. CASE OF … OTHERWISE … ENDCASE selects one of several possible values. Conditions can use Boolean values and comparison/logical operators such as >, <, =, >=, <=, <>, AND, OR, NOT.

IF Age < 18
 THEN
  OUTPUT "Child"
 ELSE
  OUTPUT "Adult"
ENDIF

An IF statement placed inside another IF is a nested IF.

Iteration

LoopWhen used
FOR … TO … NEXTWhen the number of repetitions is known.
REPEAT … UNTILWhen the number of repetitions is not known and the loop must run at least once. The condition is tested at the end (post-condition).
WHILE … DO … ENDWHILEWhen the number of repetitions is not known and the loop may run zero times. The condition is tested at the start (pre-condition).

Input and output

INPUT is used to enter data into a variable. OUTPUT displays information. The source notes that READ is commonly associated with files and PRINT may be used when hard copy is required.

INPUT Name
INPUT StudentMark
OUTPUT Name
OUTPUT "Your name is ", Name
Check structure diagrams, flowcharts and pseudocode.

Topic 7.2 revision checklist

Explain how a system can be divided into sub-systems.
Define top-down design and stepwise refinement.
Explain why modular development can reduce development and testing time.
Decompose a problem into inputs, processes, outputs and storage.
Interpret and construct structure diagrams.
Know the standard flowchart symbols and their purposes.
Explain that flowchart arrows show control flow.
Use pseudocode assignment, conditions and loops.
Distinguish FOR, REPEAT and WHILE loops.
Use INPUT and OUTPUT statements correctly.
Ready for a mixed Topic 7.2 check?
← Topic 7.1 Program development life cycleComputer Science contentsTopic 7.3 Explaining the purpose of an algorithm →