A good model is general enough that the same structure fits a different situation later.
Relevance is a judgement about the problem, not about the detail: a robot’s paint colour is noise in a race prediction and the whole point in a paint-matching system.
What is the minimum information needed to start the task and to finish it?
Which details could be removed without changing the answer?
Example
Scenario 1: a school lunch ordering app that predicts how many lunches the cafeteria should prepare.
Main goal: estimate the meals needed so food is not wasted and no student goes without.
Minimum information: students expected in school, how many usually bring lunch from home, and past sales figures.
Removable: tray colour, table layout, and the music playing at lunchtime.
Scenario 2: predicting the winner of a robotics race.
Main goal: estimate which robot is most likely to finish first.
Minimum information: motor speed, battery life, weight, and each robot’s record of mechanical failures.
Removable: paint colour, team T-shirt designs, and the background music at the event.
Algorithmic Design: Turning a Method into Ordered Steps
An algorithm is a step-by-step set of instructions that solves a problem or produces a required outcome.
Every step has to be clear, precise and unambiguous, so that two people following it get the same result.
An algorithm is not the same thing as a program: it can be written as ordered sentences, as pseudocode, or as a flowchar, and only later turned into code.
Three questions shape the design:
What is the problem, stated in one clear sentence?
What data goes in, what must come out, and in what format?
Where are the decisions (branches) and the repeats (loops)?
Example
Problem: find the largest number in a list.
Input the list and set BIGGEST to the first item in it.
For each remaining number in the list, compare it with BIGGEST.
If that number is greater than BIGGEST, set BIGGEST to that number.
Output BIGGEST.
Starting from the first item rather than from zero is what makes this work on a list where every value is negative.
Decomposition: Splitting the Problem, Not the Program
Decomposition breaks a complex problem or system into smaller parts that can each be understood on their own.
Each part should have one clear job, which is the idea behind the single responsibility principle.
Can this be split into smaller, clearly ordered steps?
Which parts are independent, and which have to happen in sequence?
Can the split be drawn, so someone else sees the structure at a glance?
Common Mistake
Decomposition breaks down the problem, not the program.
At the point decomposition happens there is no program yet, so an answer that says “splitting a program into sub-programs” is describing modularization and loses the mark.
Write about the parts of the situation instead: the ordering, the payment, the reporting.
Decomposing an Online Exam System
An online exam system looks like one problem until it is split by responsibility.
Question bank
Store questions with their options, correct answers and topic tags.
Exam assembly
Select a set of questions to a given specification and fix their order for each candidate.
Candidate authentication
Confirm who is sitting the exam and release the paper only at the start time.
Answer capture
Record each response as it is given and save progress, so a dropped connection loses nothing.
Timing and submission
Track the time remaining for each candidate and submit automatically when it runs out.
Marking
Compare captured answers against stored answers and produce a score per candidate and per topic.
Reporting
Return results to candidates and topic breakdowns to teachers.
Each part can now be designed, coded and tested on its own, and several can be built at the same time because the question bank does not depend on the marking rules.
Note
This is one acceptable decomposition of many.
Splitting the same system by user role, into a candidate view, an invigilator view and a teacher view, is equally valid as long as each part still has one clear job.
Pattern Recognition: Reusing a Solution That Already Works
Pattern recognition is spotting similarities, trends or recurring structures within a problem or its data.
A recognised pattern lets an existing solution be reused or adapted instead of designed from scratch.
Patterns turn up in numbers, in shapes, in behaviour over time, and in the way data is organised.
Three questions to ask:
What repeats, and what stays the same on each repetition?
Which solution I already know matches that shape?
Is the pattern general enough to cover the cases I have not seen yet?
Example
Scenario 1: each row of a triangle pattern holds one more triangle than the row above it, giving 1, 2, 3, 4.
The pattern is a constant increase of one, so the next row holds five.
Written as a rule this is next = current + 1, which generalises to any sequence growing by a fixed step.
Scenario 2: a system that recognises apples, bananas and oranges from photographs.
Pattern recognition starts by extracting features: colour, outline shape and surface texture.
Apples are red or green with a round outline, bananas are long and curved and yellow, and oranges are round with a textured skin.
Matching a new image’s features against those stored patterns is what classifies it.
The same feature-matching structure works on handwritten digits, where the recurring pattern is the closed loop shared by 0, 6, 8 and 9.
The Four Concepts Work Together, Not in Sequence
The four concepts are not four stages to be worked through in a fixed order.
Designing the lunch ordering app might begin with pattern recognition, noticing that last year’s sales repeat weekly, and only then abstract away the details that do not affect the forecast.
Decomposition and algorithmic design usually interleave, because writing the steps for one part often shows that the split was in the wrong place.
Active recall
Name the four fundamental concepts of computational thinking.
Why is it wrong to define decomposition as breaking a program into sub-programs?
What are the three questions to ask when abstracting a problem?
Why should a search for the largest value in a list start from the first item rather than from zero?
Give one pattern that lets an existing solution be reused on a new problem.