Computational Thinking: Four Moves You Can Practise
Computational thinking is how you get from "I want a bin that tells me when it is full" to a list of instructions a micro:bit can actually run.
The four moves are decomposition, pattern recognition, abstraction and algorithmic thinking.
You loop back through them rather than working straight down the list, because cutting a problem up usually shows you a pattern you had not noticed.
None of the first three moves needs a computer in front of you; a pencil and the back of a page is enough.
In MYP design this thinking mostly shows up in Inquiring and analysing and Developing ideas, long before a line of code gets typed.
Decomposition: Cut Until Each Piece Is One Job
Definition
Decomposition
Breaking a big problem into smaller parts that can each be solved on their own.
Decomposition means splitting one large problem into smaller problems you can solve one at a time.
A school locker booking app sounds like a single thing until you cut it into five: store the lockers, check which are free, take a booking, show a confirmation, release everything at the end of term.
The test for whether you have cut far enough is simple, because you should be able to picture roughly what the code for one piece looks like.
Cut too little and you are still staring at a problem with no obvious first line.
Cut too far and you end up with forty fragments and no sense of how they join, so stop when a piece does exactly one job.
Pieces that do one job also split neatly between people, so a group project can run three ways at once.
Example
A digital thermometer display breaks into three pieces: read the sensor, convert the reading to degrees Celsius, show the number on screen.
Each piece can be tested on its own before you join them together.
If the screen shows 273 instead of 21, you already know the fault is in piece two.
Patterns Are the Work You Only Do Once
Pattern recognition is spotting that two parts of your problem have the same shape.
In the locker app, "is this locker free" and "is this locker mine" both take a locker number and hand back true or false.
Once you see that shape you write one checking routine and feed it a different rule, instead of writing two routines that drift apart later.
Patterns also cross projects, since a countdown timer, a step counter and a quiz score all hold one number that changes and gets displayed.
A repeated pattern is your signal to write a function, which is covered in the functions and modular design article.
Analogy
Pancakes, crepes and Yorkshire puddings all start from the same flour, egg and milk batter.
Spotting the shared batter means you learn one thing and vary it, rather than learning three recipes from scratch.
Abstraction: Deciding What to Ignore
Definition
Abstraction
Deciding which details of a problem to ignore so you can work with the parts that matter.
Abstraction is throwing away the detail that does not change the outcome.
The London Underground map is an abstraction, because it drops real distances and street layout and keeps only order and interchanges, which is all a passenger uses.
In code, a variable called distance holding the number 42 ignores whether the thing 42 centimetres away is a wall, a hand or a cat.
You have to understand a problem well to abstract it well, since you can only drop a detail safely once you know it does not affect the answer.
Abstract too hard and you lose something you needed, like a reversing sensor that ignores height and drives straight into a low bollard.
Common Mistake
Dropping a detail is a decision, so write it down in your design folder next to the model it belongs to.
A moderator can follow your thinking when an ignored detail is named, and cannot when it simply vanished.
Algorithmic Thinking Puts the Pieces in Order
Algorithmic thinking is arranging your pieces into a sequence of steps with no gaps and no room for interpretation.
Order carries meaning, so you read the moisture sensor before you compare it, and compare it before you switch the pump on.
Every step has to be something the machine can do, so "work out if the soil is dry" becomes "if the moisture reading is below 400, treat the soil as dry".
Choices and repeats belong in the sequence too, such as "check every 30 minutes" or "only water if it has not watered in the last 6 hours".
Once the order is settled you have something worth drawing as a flowchart, which the next article covers.
Activity
Take your own design problem and write out the five pieces it decomposes into.
Circle any two pieces that take the same kind of input and give back the same kind of answer.
Write one sentence naming a detail you are choosing to ignore and why it is safe to ignore.
Worked Example: A Bag Tag That Reminds You What to Pack
Year 8 students keep turning up without PE kit, so the brief is a small tag on the bag that shows what today needs.
Decompose it into five pieces: know what day it is, store a timetable, work out what that day needs, tell the student, let the timetable be edited.
Spot the pattern, since "what does Monday need" and "what does Thursday need" are the same lookup with a different day, so you write it once and call it five times.
Abstract away the subject names, because the tag only needs short item codes like PE, ART and SWIM to fit a 5 character display.
Sequence it as: on button press, read the day, look up that day's list, show each code for 2 seconds, then sleep.
That whole plan fits on one page of your design folder and is evidence for Developing ideas before any hardware is switched on.
Active recall
How do you know when you have decomposed a problem far enough?
Why does spotting a repeated pattern save you work twice over?
What does the Underground map choose to ignore, and why is that safe?
Give one example of a step that is too vague for a machine, and fix it.
In the bag tag example, which of the four moves produced the 5 character display limit?