Coding Module for 2nd Graders

Teaching is hard work.

I had the privilege of being a guest lecturer at my friend’s 2nd grade class to talk about computers and programming! Not only did I get the chance to design a teaching module, but I could use it in action as well. I was alloted about 2 hours to spend with the students, so I had to plan accordingly. Below is an outline of my lesson plan.

Happy coding!


Coding Module

Topic: Coding and computer science

Target: 2nd graders, 6-8 years old

Time: 1.5-2 hours

Student Learning Objectives:

  • Be able to solve simple logic problems using psuedocode
  • Understand basic programming concepts/logic


  • Write a messagei, e.g. “Hello World”, on the board in binary or ASCII.
  • Print out binary or ASCII table as a handout.

Part I: Hands-Free Coding


  1. Have students decipher the coded message on the board. (Make it a race!) Explain why things need to be translated for computers and humans to communicate.
  • “Hello world!” is traditionally the first program a programmer writes in a new language.
  1. Pose questions to students. Encourage participation by raising hands and then calling on them for examples.
  • How many of you have a computer at home? How many of you use the computer at home? What kinds of things do you do on it? (Raise your hand if you use it to play games… chat with your friends…. etc.)
  • What is code? It’s like a set of instructions in a language a computer can understand.
  • What kinds of things require code besides computers?

Computers and Code


  • Parts of a computer and that they work together
  • People > Code > Computers > Do things


  1. Explain parts of a simplified computer, i.e. CPU + Memory + Display. Draw on board.

  2. Bring old, non-functional computer parts to show in front of the class. Pass them around the room so students can see/feel them.

  3. Questions:

  • Do any of you know what’s inside of a computer?
  • Why does a computer need so many different parts?
  • What would happen if one part of the computer was hit with a slow motion ray gun and moved 100000000x slower?



  • There are many ways to achieve the same solution in a program.
  • Loops, if/else statements, boolean logic


  1. Give each student a piece of paper and have them divide it into 4 quadrants. On each quadrant, write a random “problem” from a predetermined list. One at a time, instructor will call out a “solution.” If the student thinks that the solution can be used to solve a problem on the quadrant, write it below. Student will yell out “Four Square!” or raise his/her hand if all four quadrants are solved. Have the student explain why he/she choice each solution. Emphasize that the same solution can be used for multiple problems.
  • How were the winners able to win so quickly?
  • Do all problems have the same solution?
  • Can a solution only be used for one problem?
  • Did anyone use the same solutions as the winner? Did anyone use a different solution for the same problem?
  • There are many ways, or many solutions, when writing code for a computer to do something.
  • Computers are built by humans, so they only know what to do based on what a human tells it to do. All of us think differently, so we will have different instructions for the computer, but end up with the same result.
  1. Have the children line up in the row. Stand on the opposite side of the room with your back turned, like in “Mother, May I?” The goal is to reach the other side but you can only move based on the instructions. Use if/else statemnts and booleans.
  • e.g. IF you are wearing red, THEN take 2 steps; everyone ELSE take 1 step.
  • e.g. IF your birthday is in January OR October, THEN take 2 steps; ELSE take 1 step back.
  • At each turn, did everyone take an equal number of steps? Why did one person take fewer or more steps?
  • What were some words that you hear me say most often?
  • When writing code, we have to be very clear in our instructions. Somtimes we only want to do something IF something happens, e.g. we eat a sandwich IF we are hungry, ELSE we do not eat a sandwich.

Part II: Computer Activity

Let students explore coding games/activities from list of links for the remainder of the time. Have handouts to pass around with additional resources if they want to try more at home.