Socks First, Then Shoes!
Byte the friendly robot sits on a sunny rug, holding one striped sock and one red shoe, getting ready to put them on its foot.
- Identify that the same steps can be done in a different order.
- Predict what happens when two steps swap places.
- Order two simple steps so the result works correctly.
- Explain to a friend why changing the order of steps changes the result.
Key terms
- sequence
- a set of steps lined up one after another
- order
- which step comes first, next, and last
- step
- one single action in a sequence
- result
- what happens after all the steps are done
Same Steps, New Order
A surprising idea in computing is that you can keep the very same steps and still get a brand new result, just by changing their order. Byte uses the same sock step and the same shoe step both times. Nothing about the steps themselves changes. The only thing that changes is which one happens first. Sock then shoe works perfectly, but shoe then sock does not. The steps stayed the same, yet the order changed the whole outcome.
First, Next, Last
When you line up steps one after another, you make a sequence. Every sequence has a first step, a next step, and a last step. In a good sequence, each step gets the result of the step before it. The sock goes on the bare foot, and then the shoe slides over the sock. If you swap the order, the shoe is already on, so the sock has nowhere to go. Thinking about first, next, and last helps you put steps in an order that actually works.
Worked examples
Predict what happens if Byte puts the shoe on before the sock.
- Step one is now shoe, so the shoe goes onto the bare foot.
- Step two is now sock, but the sock must go over the shoe.
- A sock cannot stretch over a shoe, so the foot ends up wrong.
Answer: The sock will not fit over the shoe, so the wrong order does not work.
Activity
Put Byte's two steps in the right order so the sock and shoe fit.
Practice
Put these two steps in the right order: turn the page, open the book.
Tell a friend why sock first then shoe works but shoe first then sock does not.
Common mistakes to avoid
- Order never changes anything.Changing the order of the same steps can change the result, like the sock and shoe show.
- Swapping the order means you used new steps.The steps stay exactly the same; only their order changes, which is enough to change the outcome.
Check your understanding
Byte wants to dress its foot. Which step goes first?
What happens if Byte puts the shoe on first, then the sock?
Byte used the same two steps but switched the order. Why did the result change?
Recap
A sequence is a set of steps lined up first, next, and last. Putting the same steps in a different order can change what happens, because each step often needs the result of the step before it. Sock before shoe works, but shoe before sock does not, even though the steps never changed.
Reflect
Can you name a chore at home where doing the steps out of order would cause a mess?