Introduction to coding for grades 2-6
1 Hook/Attention Getter
Make sure you have registered for Code.org and enrolled your students in Course 2.
Using the Code.org website, play the video on the front page for the students to get them excited about coding.
Watch the video.
2 Introduction of Vocabulary
Introduce the two vocabulary terms:
Algorithm - a list of steps to get something done.
Program - an algorithm that has been coded to be run by a machine (computer)
Discuss typical algorithms students use each day - even if they do not use that term. (brushing teeth, tying shoes, etc.)
Repeat the vocabulary words
Discuss everyday algorithms.
3 Direct Instruction
Print out the 4x4 grids available in lesson 1 of course 2 on Code.ord
(You may want to do one or two together as a whole class for practice)
Use the grids to have the students randomly fill in 6 of the 16 squares in one of the grids.
Have the students then write the "code" for their "program" (drawing) by starting in the upper left hand corner and using the following symbols. Left arrow = move one square left, Right arrow = move one square right, Up arrow = move one square up, Down arrow = move one square down, Squigly line = fill in that square.
Have students create their own drawings (programs) and write the codes (using the symbols) for their drawing.
4 Guided Practice
Have the students trade their codes for their pictures they created in the last step.
Have the students follow their partners code to try to recreate their partner's drawing in another one of their 4x4 grids.
After they complete the drawing, have the students compare their drawing with their partner's original. If the pictures match, have the students create another drawing and trade again. If the drawings do not match, have the students try to figure out where the mistake was made, and wheter it was a mistake by the computer (them drawing the picture) or by the coder (their partner) and how they could fix the problem.
Students will trade codes and recreate each other's pictures.
When finished, students will compare pictures. If they match, they can do another one (more complex if they choose). If they do not match, students will try to figure out where the problem was and whether it was a mistake by the computer (them drawing the picture) or by the coder (their partner) and try to fix the problem.
Ask the students to raise their hands to see how many pictures matched perfectly, how many were close, and how many were far off.
Explain to the students that they got the chance to be the coder/programmer and the computer.
Explain to the students that the purpose of this lesson was to introduce them to the vocabulary as well as show them that a computer is only as good as its code. A computer will follow the code exactly and the more complicated/complex a coder makes the code, the bigger chance that they will make a mistake along the way. This will make the program not turn out the way that they wanted it to. The simpler/easier a code is, the more likelihood of the program turning out the way the coder wanted it to.
Students will discuss how well their pictures matched and how well they performed in the role of the coder/programmer and in that of the computer.