Why the Order of Steps Changes What Happens
Byte the robot stands in a bright kitchen holding a loaf of bread and a butter knife, looking puzzled at a slice of bread that has been put away in a lunchbox still unspread, while a perfectly made jam sandwich sits on the counter nearby.
- Explain that steps must happen in the right order to get the result you want.
- Identify what goes wrong when steps are done out of order.
- Compare two sequences of the same steps and describe how the outcomes differ.
- Predict what will happen if steps are swapped in a simple everyday task.
Key terms
- algorithm
- a set of steps done in order to finish a task
- order
- the position of each step from first to last
- sequencing
- putting steps in the right order so they work
- outcome
- the result you get after all the steps run
Same Steps, Different Outcome
The big idea today is that the same steps can lead to two very different outcomes just because of their order. Byte uses the same three sandwich steps both times: pick up the bread, spread the jam, and pack the lunchbox. Nothing about the steps changes. But when packing the lunchbox comes first, the jam ends up going on after the bread is already put away. The list of steps is identical, yet the order alone turned a good sandwich into a jam-less one.
How Computers Read Steps
A computer follows an algorithm one step at a time, in the exact order you give it. It does not stop to think whether the order makes sense, and it cannot rearrange the steps to be helpful. It simply runs step one, then step two, then step three. This is why writing steps in the right order is your job, not the computer's. If you hand a computer steps in the wrong order, it will run them anyway and hand you back a surprising result.
Worked examples
Predict what happens if Byte pours water before filling the cup.
- Step one is now pour the water, but the cup has not been filled yet, so it is empty.
- Pouring an empty cup sends no water to the plant.
- Step two fills the cup, but the pouring already happened, so it is too late.
Answer: The plant does not get watered, because the cup was empty when Byte poured.
Decide the right order for socks and shoes.
- Socks need to go on bare feet so they sit comfortably.
- Shoes go on after the socks so the socks fit inside.
- So the working order is socks first, then shoes.
Answer: Put socks on first, then shoes; the reverse order does not work.
Activity
Put these steps in the right order to get dressed for school in the morning.
Practice
Tell what happens if you turn off the water before washing your hands.
Write the steps to make toast in the correct order from first to last.
Common mistakes to avoid
- Different order gives the same result.The same steps in a different order can change what happens at the end of the task.
- A computer will fix the order for you.A computer runs the steps in the exact order given and cannot rearrange them to help.
Check your understanding
Byte wants to water a plant. The steps are: (1) Fill the cup with water. (2) Pour the water on the plant. What happens if Byte pours FIRST and fills the cup SECOND?
Which sentence best describes why order matters in a set of steps?
Byte puts on shoes BEFORE socks. What is the most likely problem?
Recap
An algorithm is a set of steps done in order to finish a task. The same steps in a different order can lead to a completely different outcome, like a jam-less sandwich or a dry plant. A computer follows the steps exactly as written, so putting them in the right order is your job.
Reflect
When have you done something out of order at home and ended up with a surprise result?