Computational thinking: four moves

Computer Science · Key Stage 3 · The School

The four moves

DECOMPOSITION: break the problem into parts. PATTERN RECOGNITION: notice parts that are the same. ABSTRACTION: ignore what does not matter. ALGORITHM: write the steps. These four are what computer scientists mean by "thinking computationally", and they apply far outside computing.

Abstraction is deliberate ignoring

A tube map ignores real distances, road layout and geography, keeping only stations and connections — because that is all a traveller needs. That deliberate ignoring is abstraction. A model that included everything would be as complicated as the world and just as hard to use.

Working an example

Problem: a program to mark a quiz. Decompose: read answers, compare to the key, count, report. Pattern: comparing is the same for every question. Abstraction: the SUBJECT of the questions does not matter, only right or wrong. Algorithm: for each answer, compare, add to score, then print. The four moves turned a vague task into code you could write.

Problem: get 30 children through a lunch queue faster. DECOMPOSE: choosing, paying, collecting, sitting. PATTERN: the queue always stalls at paying. ABSTRACT: ignore what the food is, the colour of the trays and who is friends with whom — only the timing of each stage matters. ALGORITHM: pre-pay at registration, split into two collection points, stagger arrival by class. Four moves, one workable answer.

Abstraction is a BET about what does not matter, and the bet can be wrong. The tube map is the example again: it is perfect for planning a journey and useless for deciding whether to walk, because two stations that look far apart on it can be two hundred metres apart on the street. Nobody drew that badly — the map ignored distance on purpose. So when you abstract, write down what you are ignoring. That list is where the bug will be if the model turns out wrong.

The School — all subjects · Knowledge map