Students will be able to describe and apply decomposition as a problem‑solving technique, recognise its link with abstraction, and relate both concepts to the Cambridge International AS & A Level Computer Science (9618) syllabus (AO1, AO2, AO3).
Choose a real‑world system (e.g., a library). List three details you could abstract away when modelling it in software.
Iteratively replace a high‑level description with more detailed pseudocode or flow‑chart steps while keeping the original interface unchanged.
High‑level: Read list of numbers
Refinement:
open file “data.txt”
while not EOF
read line
convert line to integer
append integer to list
end while
close file
Decomposition
|
function main()
numbers ← readNumbers() // input
total ← sumNumbers(numbers) // processing
count ← length(numbers) // processing
avg ← total / count
output(avg) // output
end function
function readNumbers()
// stepwise refinement: open file, read lines, convert to int
…
end function
function sumNumbers(list)
total ← 0
for each x in list
total ← total + x
return total
end function
|
Problem: Design a protocol where a client sends a text message to a server, the server acknowledges receipt, and both then close the connection.
Decomposition
Interface example (pseudo‑API)
clientSend(message:string) → ack:string serverReceive() → message:string serverSendAck(ack:string) → void
Problem: Model one iteration of the fetch‑execute cycle for a simple accumulator‑based CPU.
Decomposition
Abstraction: The “Execute” step is abstracted as a black‑box function execute(opcode, operand) that hides the internal micro‑operations.
Problem: Store student results so that data redundancy is minimised.
Decomposition
Student, Course, Result.Student{id, name}).Problem: Find the shortest path between two nodes in an un‑weighted graph.
Decomposition
Abstraction: The “enqueue neighbours” step is abstracted as expand(node), hiding the underlying adjacency‑list implementation.
IF … THEN … ELSE – decides which sub‑task to perform.FOR, WHILE/REPEAT – repeats a sub‑task.
function countPositives(list)
count ← 0
for each x in list // FOR loop
if x > 0 then // IF selection
count ← count + 1
end if
end for
return count
end function
Used when the sub‑task processes an ordered collection (e.g., average calculation, BFS queue).
record Student
id : integer
name : string
grade : integer
end record
When calculating a class average, a sub‑task extracts grade from each Student record – an example of abstraction (the rest of the record is hidden).
Useful for counting frequencies (e.g., word‑count exercise) or representing associative data such as a symbol table.
| Project Phase | Typical Decomposition |
|---|---|
| Requirement Analysis | Identify functional & non‑functional requirements; split into user stories or use‑case steps. |
| Design | Separate system into modules (UI, database, business logic, communication); define class diagrams and interfaces. |
| Implementation | Assign each module to a developer; write functions/classes for each sub‑task. |
| Testing | Create unit tests for each module; integration tests for combined modules; system tests for the whole product. |
| Syllabus Area (9618) | Typical Decomposition Tasks | Relevant AO |
|---|---|---|
| Data Representation | Break a number into binary, hexadecimal and floating‑point components; convert between bases. | AO1, AO2 |
| Communication & Networks | Separate protocol layers (physical, data link, network, transport, application); define send/receive primitives. | AO2, AO3 |
| Processor Fundamentals & Logic Gates | Decompose an instruction set into fetch, decode, execute, store phases; break a combinational circuit into gates. | AO1, AO2 |
| System Software | Separate OS functions (process management, memory management, I/O); abstract a language translator into lexer, parser, code generator. | AO2, AO3 |
| Security & Privacy | Break an authentication system into identification, verification, session management. | AO1, AO3 |
| Databases | Decompose a data model into tables, then into fields; separate CRUD operations. | AO2, AO3 |
| Artificial Intelligence | Break a search problem into state generation, goal test, and path‑cost calculation; abstract heuristic evaluation. | AO2, AO3 |
| Programming Paradigms & Recursion | Separate a problem into recursive calls (base case, recursive case) or into object‑oriented classes and methods. | AO2 |
Task: Design an algorithm that reads a text file, counts how many times each word occurs, and outputs the three most frequent words.
| Sub‑task | Input | Output |
|---|---|---|
| Read file | File name (string) | Raw text (string) |
| Tokenise text | Raw text | List of words (array of strings) |
| Count words | List of words | Dictionary {word → frequency} |
| Sort frequencies | Dictionary | Ordered list of (word, frequency) pairs |
| Display top three | Ordered list | Top three words with counts (output to screen) |
Design the schema for storing student results, then write pseudocode to compute the class average.
Result records and returns an array of integers.Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.