Nau mai, haere mai ki te whārangi "Sequence"! This page will teach you about sequence, one of the most fundamental concepts in computational thinking and programming: the order in which instructions are carried out.
Define what "sequence" means in digital technologies and programming.
Explain why the order of instructions is critical in an algorithm or computer program.
Identify and describe sequential steps in everyday tasks and simple digital scenarios.
Understand that changing the sequence can change the outcome.
To get the most out of learning about Sequence, it's essential to have a clear understanding of:
Decomposition: Can you break down a complex problem into smaller, manageable steps? (Link to Decomposition page)
Quick Check: Think about giving directions to someone. What happens if you tell them to turn left before they reach the street? The order matters, right? This is the core idea of sequence!
Sequence (raupapa) refers to the specific order in which instructions, steps, or events are performed. In digital technologies and programming, it means that a computer program or an algorithm executes instructions one after another, in the exact order they are given.
Imagine a recipe: each step (like "add flour," then "add milk," then "mix") must be followed in the correct order to get the desired result. If you add the milk before the flour, you might end up with a very different (and possibly messy!) outcome.
The exact order of instructions is absolutely critical in programming because computers are very literal – they will do exactly what you tell them, in the order you tell them. If the sequence is wrong, the program won't work as intended, or it might produce unexpected errors (Debugging).
The concept of sequence is very straightforward: instructions run from top to bottom, one after the other.
Example 1: Making a Simple Sandwich (Revisiting Decomposition)
In our Decomposition page, we broke down "Make a peanut butter sandwich." Here's how sequence applies:
Get two slices of bread.
Get peanut butter.
Get a knife.
Open the peanut butter jar.
Spread peanut butter on one slice of bread.
Close the peanut butter jar.
Put the two slices of bread together.
If you change the sequence (e.g., try to spread peanut butter before getting the jar, or put the bread together before spreading), the task will fail or produce a different outcome.
Example 2: Simple Programming (Pseudocode)
Let's imagine a very simple program to greet someone:
1. PRINT "Hello, " (Display "Hello, " on the screen)
2. GET user_name FROM input (Ask the user for their name and store it)
3. PRINT user_name (Display the user's name)
4. PRINT "!" (Display "!")
If you ran these instructions in a different sequence, the program wouldn't make sense:
1. GET user_name FROM input
2. PRINT "!"
3. PRINT user_name
4. PRINT "Hello, "
This new sequence would ask for the name first, then print "!", then the name, then "Hello, ". The original intent is lost!
Activity 1: Daily Task: Re-Sequencing
Task: Read the following jumbled instructions for a common task.
A. Put toothpaste on the toothbrush.
B. Rinse your mouth.
C. Wet the toothbrush.
D. Brush your teeth.
E. Pick up your toothbrush.
Activity: Re-order these steps into the correct sequence for brushing your teeth effectively. Explain why the correct order is important.
Evidence: Create a Google Doc or Google Slide listing the correct sequence and your explanation.
Activity 2: Programming a Robot
Task: Imagine you have a simple robot that can only understand these commands: MOVE_FORWARD_ONE_STEP, TURN_LEFT_90_DEGREES, TURN_RIGHT_90_DEGREES. Your goal is to program the robot to pick up a ball, move past a cone, and place the ball in a basket.
Activity:
Draw a simple map of the robot, ball, cone, and basket.
Write a clear sequence of instructions using only the allowed commands to achieve the goal.
Explain what would happen if you swapped two of your key instructions.
Evidence: In a Google Doc or Google Slide, include your map, the sequence of commands, and your explanation of what happens if the sequence is altered.
Check your understanding of Sequence.
Multiple Choice: In programming, what does sequence refer to?
a) How many times a set of instructions is repeated.
b) The specific order in which instructions are executed.
c) Finding errors in a program.
d) Breaking a large problem into smaller parts.
Short Answer: You are writing instructions for a simple game character to move. If you tell the character to aand then WALK_FORWARD, what might happen if you accidentally change the sequence to WALK_FORWARD then JUMP?
Scenario: A Digital Device like a washing machine follows a set of sequential steps to wash clothes.
Provide an example of a simple sequence of steps a washing machine follows.
Explain why it's critical that these steps happen in that specific order.
Sequence (raupapa) is the specific order in which instructions are performed.
The exact order is critical in algorithms and computer programs.
Changing the sequence can lead to incorrect or unexpected outcomes.
Understanding sequence is fundamental to effective computational thinking and problem-solving.
Now that you understand that instructions run in a specific order, you're ready to combine this knowledge with other powerful ideas to build complete solutions:
Algorithms: Learn how a series of precisely sequenced steps forms a complete solution to a problem.
Computer Program: Discover how programming languages are used to write instructions that follow a specific sequence.
Debugging: Understand how to find and fix errors when the sequence of instructions doesn't work as expected.
Selection: Explore how programs can make choices and take different paths within a sequence of instructions.
Iteration: Learn how to repeat a sequence of instructions multiple times efficiently.
Formal Languages: Understand how the strict rules of programming languages are built around defining clear sequences of commands.
Design Process (Iterative Development): See how defining the sequence of tasks is a crucial part of planning and developing digital outcomes.
Continue your journey by clicking on the links to these exciting topics!