The Need for Programming Languages and Algorithms
Lesson Topic:
The need for programming languages and algorithms
Lesson Description:
Students will learn the need for programming languages. The lesson will make a connection between programming languages and algorithms. The lesson involves a student group activity and will follow with connections to content.
Learning Goals/Outcomes:
- Assess the clarity of a set of instructions expressed in human language.
- Create a set of instructions in human language for building a simple LEGO block arrangement.
- Identify connections between the ability to program and the ability to solve problems.
- Describe the ambiguities inherent in human language and the ways programming languages seek to remove those ambiguities.
Nebraska Standards:
NE.CIS.HS.8.1.f Describe algorithms using foundational principles of sequence, selection, and iteration with non-code techniques
NE.CIS.HS.8.2. Deconstruct a complex problem into distinct functional parts using predefined constructs of a programming language
Teacher Planning:
Equipment/Materials/Software Needed:
Students will need paper to write on. A premade worksheet will work, but so would a blank piece of paper.
Time Required for Lesson:
Activity will take 20 minutes. Discussion at the end could take 10-15 depending on how deep the discussion goes. If you use the extension activity, the lesson could take 45 minutes total.
Diagram/Setup:
Students will start individually and then be grouped with 3-4 students later in the activity.
Technology Use:
Software:
N/A Unless you want to project your instructions and expectations during the activity.
Hardware:
N/A
Instructional Plan:
Anticipatory Set/Pre-Activity:
2-3 minute discussion about how human language is filled with ambiguities. You can give examples of things that can be misinterpreted (or steps skipped). The classic example is "making a peanut butter and jelly sandwich". Students may say toast the bread, put on PB &J, and eat. They may skip the important steps of taking the bread out of the packaging, setting the toaster to specific settings, putting the two pieces of bread together after putting the PB and jelly on. This may be implied, but later you will make the connection that a computer can't "imply" meaning. It has to be spelled out (thus the programming language).
Benefits/Explanation/Real-World Connection:
When you formalize language or commands that describe actions you are making a kind of code. This is also necessary for computers, which are simply machines that can perform a number of different tasks. In order to write instructions for them to do something you must agree on the “code” and each action must have a precise, unambiguous meaning. This is a programming language. All programming languages are derived from the human need to concisely give instructions to a machine.
Activities (i.e. instructions, warm-up, lesson, cool-down):
Building Block / LEGO Activity
Groups should create an arrangement of their blocks in accordance with the following rules:
- All pieces must be connected in a single arrangement.
- Color matters: the final arrangement must be absolutely identical to the original.
- Groups should record their arrangement by taking a picture or creating a simple drawing.
Write instructions for building your arrangement -- On a separate sheet of paper, each group should write out a set of instructions, that another group could use to create the same arrangement. A couple of guidelines are below:
- You may only use words when creating these instructions. In particular, you may not include your image or draw images of your own.
- Try to make your instructions as clear as possible. Your classmates are about to use them!
Trade instructions and attempt to follow them
Groups should disassemble their arrangements, place their instructions next to the pieces, and hide their image or drawing of the arrangement somewhere it cannot be seen. Have students move around the room to other students’ instructions and try to follow them to build the desired arrangements. Have the original student check whether the solutions are correct or let groups check their solutions themselves by looking at the recorded image of the arrangement afterwards. Allow students an opportunity to try a few of their classmates’ instructions before reconvening.
Closure:
Bring the class back together and use the following discussion prompts:
Were you able to create the intended arrangement? Were your instructions as clear as you thought? Why did we run in to miscommunications? Is it really the fault of your classmate or is something else going on?
Try to pull out the fact that even though the instructions may seem precise, there were areas of human interpretation. In every day instructions, that may be fine, but for using a computer language and algorithms, we need to be more precise.
Let students discuss at the tables the following prompt: If we were going to change human language to improve our odds of succeeding at this activity, what types of changes would we need to make? Let them discuss before sharing with the class.
Key ideas to bring out are:
- As long as there are multiple ways to interpret language, we cannot have exact precision.
- If we rigorously define the meaning of each command we use, then we can avoid misinterpretation and confidently express algorithms.
- All parties must agree upon the meaning of each of the defined commands.
- This is different from the way we normally think and talk, and it might even take a while to get comfortable with communicating in this way.
Students may say things like “We could be really careful about our language” or “We could include more detail.” These are entirely true, but emphasize that if there’s room for interpretation then we can’t be certain about our results. Move towards the solution of creating a new language (a programming language) in which we have strictly and precisely defined exactly what every word means.
Assessment :
Formative Assessment prompt that could be written at the bottom of the paper they used in the activity to be collected.
- Consider the algorithm you designed for today’s activity. Identify two instances where there may be multiple ways to interpret your instructions and suggest improvements that could be made to improve their clarity.
- Describe the features of a programming language that make it different from the language you are used to using in everyday life. Explain why a programming language must be created in this way.
Supplemental Information:
Modifications:
Ask students to define a small set of commands that could be used to build any arrangement of LEGO blocks. For example: “rotate”, “attach”, “detach”, “move”, etc. Feel free to let students select their own and then test out their new and more precise set of commands by repeating today’s activity using them.
Safety Precautions:
N/A
Comments (adaptations for various grades/ages, teaching styles, etc.)
I found that 5-6 blocks with upper level high school is fairly easy. You may want to add more blocks to it, but wouldn't go past 10 for an initial trial. If you wanted to do the extension with predetermined language, students can create more complex instructions and recreate their classmates more easily. You could do that activity to demonstrate the increased clarity and precision.