Chapter 1. Computational Thinking: Solving Problems Step by Step FREE
1. Computational Thinking: Solving Problems Step by Step
Have you ever made a peanut butter sandwich, packed your school bag, or explained to a friend how to get to the tuck shop? Each time, you broke a big task into small, clear steps. That is the heart of computational thinking, a way of thinking that helps you solve problems the same clever way a computer does.
Computational thinking does not need a computer at all. It is a skill you use in your head, on paper, and one day in code. In this chapter you will learn the four main skills that make up computational thinking, and you will practise them using everyday South African examples.
1.1 What is a problem?
A problem is simply a task you need to finish or a question you need to answer. "How do I sort 30 learners into 5 netball teams?" is a problem. "What is the shortest walk from class to the school gate?" is a problem. Computational thinking gives you a toolbox to crack problems like these in a calm, ordered way.
1.2 The four skills of computational thinking
Computer scientists use four big ideas. Learn the names: you will use them all year:
- Decomposition: breaking a big problem into smaller, easier parts.
- Pattern recognition: spotting things that repeat or look the same.
- Abstraction: keeping only the important details and ignoring the rest.
- Algorithms: writing a clear list of steps to solve the problem.
1.3 1. Decomposition: break it down
Imagine your gran asks you to cook pap for the family. "Cook pap" sounds big and scary. But decompose it into small steps and it becomes easy:
- Boil water in a pot.
- Add salt.
- Stir in the maize meal slowly.
- Let it cook on low heat.
- Stir until it is firm.
Each little step is something you know how to do. Decomposition turns one hard job into many small, simple jobs.
1.4 2. Pattern recognition: spot what repeats
A pattern is something that happens again and again. If you are drawing the South African flag many times, you notice the same shapes and colours repeat each time. Once you see the pattern, you do not have to think about it freshly every time, you reuse what you already know.
Look at this number pattern: 5, 10, 15, 20, ... The rule is "add 5 each time". Because you spotted the pattern, you instantly know the next number is 25. Computers love patterns because they can repeat the same step very fast.
1.5 3. Abstraction: keep only what matters
Abstraction means leaving out the unimportant details. Think of a map of Cape Town. The map does not show every tree, dog or pothole, that would be too much. It shows only the streets and important places, because that is all you need to find your way. A map is an abstraction of the real city.
When you draw a stick figure to show a person, you are using abstraction too. You keep the head, body, arms and legs, and you ignore hair, clothes and shoes. Abstraction helps you focus on the part of the problem that really counts.
1.6 4. Algorithms: a list of clear steps
An algorithm is a set of step-by-step instructions that solves a problem. A recipe for melktert is an algorithm. The steps to log in to a tablet are an algorithm. A good algorithm has steps that are clear, in the right order, and that always end.
Worked example: Algorithm to wash your hands:
- Step 1: Open the tap.
- Step 2: Wet your hands.
- Step 3: Put soap on your hands.
- Step 4: Rub your hands together for 20 seconds.
- Step 5: Rinse the soap off.
- Step 6: Close the tap.
- Step 7: Dry your hands.
Notice that the order matters. If you closed the tap (Step 6) before rinsing (Step 5), the algorithm would not work. Computers follow steps exactly, so the order must be correct.
1.7 Putting it all together
Say your class of 20 learners must share 100 oranges equally. Use all four skills. Decompose: first find how many each person gets, then hand them out. Pattern: sharing equally is the same as dividing. Abstraction: ignore the colour and size of the oranges, only the number matters. Algorithm: divide \( 100 \div 20 = 5 \), then give each learner 5 oranges.
If oranges cost R3,50 each, you could even work out the cost: 100 oranges would cost \( 100 \times \text{R}3{,}50 = \text{R}350 \). Computational thinking helped you plan it neatly before doing any sums.
Why this matters
Everything you will do in coding and robotics this year, telling a robot where to drive, making a game character jump, sorting data in a spreadsheet, starts with computational thinking. Learn to think in clear steps now, and the coding will feel easy later. Remember the four skills: decompose, spot patterns, abstract, and write an algorithm.