What is a Pattern? Look at a set of traffic lights and watch for a while. Red. Yellow. Green. Yellow. Red. Yellow. Green. Yellow. Red. Something keeps repeating. The same sequence: Red → Yellow → Green → Yellow. Over and over, in the same order, every single cycle. That is a pattern . The Simple Definition A pattern is something that repeats in a predictable, recognisable way . Patterns have two ingredients: 1. A repeating unit — the thing that happens (the sequence Red → Yellow → Green → Yellow) 2. Repetition — that thing happens again and again Once you know the repeating unit, you can predict what comes next. That is what makes a pattern useful — it is predictable. The Flashing Light Think of a string of festival lights that blink. ON. OFF. ON. OFF. ON. OFF. The repeating unit here is just two steps: turn on, then turn off. But together, repeating over and over, those two steps create the entire blinking effect. A programmer writing the instructions for this does not write: > Turn on → Turn off → Turn on → Turn off → Turn on → Turn off (and so on forever) They write: > Turn on, then turn off. Repeat this forever. The repeating unit is written once. The repetition takes care of everything else. Patterns You Already Know Pattern Repeating Unit How Many Times --- --- --- Traffic lights Red → Yellow → Green → Yellow Forever (until switched off) Blinking festival lights On → Off Forever (until switched off) Heartbeat Beat → Pause Forever (while alive) School timetable Monday → Tuesday → Wednesday → Thursday → Friday Every week Song chorus Verses alternate with the chorus 3–4 times per song Seasons Spring → Summer → Autumn → Winter Every year Every one of these involves a repeating unit that shows up over and over. Every one of them is a pattern. Patterns in Programming In programming, a pattern is powerful because it means you only have to write the instructions once . Think about a video game enemy that patrols back and forth: Walk left 10 steps Walk right 10 steps Walk left 10 steps Walk right 10 steps This could go on forever. But the repeating unit is just two steps: walk left, then walk right. The programmer writes that unit once and says "keep repeating this." Without patterns, you would have to write out every individual step. With patterns, you write the unit once and describe the repetition. Spotting a Pattern How do you spot a pattern? Look for things that: Happen more than once Happen in the same order each time Could be described as "do this, then do this — and keep repeating" If something repeats, there is a pattern hiding in there. And if there is a pattern, a programmer can use it to write shorter, simpler, more powerful instructions. 🎯 Try This Yourself The Secret Bracelet Code You need a long strip of paper and three kinds of small things — buttons, beads, dried pasta, or just three coloured pens. 1. Pick a repeating unit of three or four items. For example: red, red, blue. 2. Lay that unit out again and again, in the same order, until you have a line of about twenty items. 3. Cover the last six with your hand. Ask someone to tell you what the next three items are. 4. Now build a second line, but change the unit secretly halfway through — red, red, blue… then suddenly red, blue, blue. Ask them to point at the exact item where the pattern breaks. What to watch for: to guess what came next, they first had to work out the repeating unit — and they found the shortest block that repeats, not the whole line. That is exactly what a programmer looks for. The shortest repeating block is the only piece you ever have to write down. 🤔 Check Yourself 1. A line goes: red, blue, red, blue, red, blue. What is the repeating unit? Red, blue — two items. You could say the unit is "red, blue, red, blue", and technically that repeats too. But the shortest block that repeats is the useful one, because it is the least you have to write. 2. Your heart goes beat, pause, beat, pause. Is that a pattern? How many times does the unit repeat? Yes, it is a pattern. The repeating unit is beat → pause . There is no set number. It repeats for as long as you are alive. Some patterns run a fixed number of times; others simply carry on until something stops them. 3. A game enemy walks left 10 steps, right 10 steps, left 10 steps, right 10 steps — forever. How many instructions does the programmer actually write? Two , plus the words "keep repeating this". Walk left 10 steps. Walk right 10 steps. Everything after that comes free. The enemy could patrol for an hour and the programmer still only wrote two lines. 🔑 Words You Just Learned Word What it means --- --- Pattern Something that repeats in a predictable, recognisable way Repeating unit The smallest block that repeats — the bit you actually write down Repetition That unit happening again and again ✅ Summary A pattern is something that repeats in a predictable, recognisable way. Patterns have a repeating unit (the smallest block that repeats) and repetition (that unit happe…