Students will create a map or list of instructions of a morning activity. This activity can be run independently or in groups of students.
- Optional: 2 coloured pens/highlighters
- Explain an algorithm as a plan or step-by-step instructions for solving a problem.
- When you make a plan there may be lots of different ways to solve a problem.
- When you are solving a problem it helps to know what the problem is and what outcome you want to end up with. It also helps to make a plan of the steps it takes to get the outcome you are hoping for.
- Explain that computers have different languages that we use to give them instructions these are called programming languages.
- When we are thinking through a program we’d write for a computer it helps to write something called pseudocode. This is “fake” or human readable code that follows the same process or procedural step-by-step way computers need in order to understand something we want them to do.
- In walking students through a pseudocode activity you can first explain functions, conditionals, and loops
- the sample pseudocode attached can serve as a way to introduce students to the syntax of pseudocode.
- Some programming languages have very strict rules whereas pseudocode can be written in anyway since we aren’t dependant on a computer to read it. The important thing is that the plan is clear and that we understand the steps that we’d need to communicate to a computer.
- Explain to students that the yellow highlighted steps are if/else statements or moments where you’d stop and make a choice juice or milk.
- The pink highlights are loops or steps where you are doing something repeatedly such as taking sips of a drink.
- The steps that are not highlighted can be called statements or functions or procedures. These functions are pretty straight-forward these steps won’t change based on a condition like the weather or their choice of breakfast meal.
- Have students choose one aspect of their morning to “code” or map e.g. eating breakfast, brushing their teeth, riding a bus/bike to school, morning announcements.
- If students are confused about where to start let them know that as per the example they can add start at the beginning and stop at the end.
Prompt students by having them reflect on what steps they might overlook because they have done this activity before.
- Once the students have chosen their activity have them write out each step it took to complete this activity as if they were explaining it to an alien or someone who had never done this before.
Explain to students that they have just written an algorithm for their morning. As per the definition of an algorithm they have written a step-by-step set of instructions for the task they chose at the beginning of the lesson.
- Encourage students to explain the concepts to each other and overcome any confusion they may have around these new terms.
- Have students incorporate one or two choices in their map of their morning.
When students have finished their steps ask if there are any steps that had a choice in them?
Next ask if there are any steps that are repeated? For example if they chose brushing their teeth do they just push the tooth brush back-and-forth once? No they’d do that multiple times OR if they chose eating breaking do they just take a bite of cereal once? No they would take multiple bites of cereal.
- For example did they choose to put on rain boots because it was raining? Did they choose between two breakfast foods cereal or bread?
- Now have students go through their steps and find the points where they made a choice and highlight those steps in yellow or draw a square around them.
Have students highlight the steps that get repeated in pink OR have them circle those steps.
Explain the rest of the steps that are not highlighted would be considered the statements, or functions, or procedures.
The yellow or square steps would be the conditionals they are decision points where a condition was met or not met to influence the outcome. Computers are great at using these steps to decide what to do next in a program or plan.
The pink or circled steps are can be called loops. Computers are really good at these repeating commands. In them a step gets repeated several times.
Explain that computers seem really smart but in fact are only good at following instructions step-by-step just like we did with the pseudocode.
- Did it take more or less steps than you thought to map out the activity you chose?
- Were there any concepts that were super confusing or you didn’t understand? See if you can have another student explain it to them as the “coding advocate”.
- Did they do these activities in the a.m. or p.m.?
- Students could also go through and add duration estimates beside each step and add up the total time to do the activity.