Code Detectives: Early Coding and Computer Safety Lesson for Kids

Teach young children how computers follow instructions, recognize friendly and strange messages, and practice digital safety with this engaging Code Detectives lesson. Includes hands-on coding patterns, message sorting, trusted-adult safety rules, activities, assessment, differentiation, and the “Stop, Check, Ask” chant.

Previous Lesson
PDF

Code Detectives: Safe Computer Messages

Materials Needed

  • Large paper or a whiteboard
  • Crayons or washable markers
  • Three paper “message cards” labeled Friendly, Strange, and Ask an Adult
  • Toy blocks, buttons, or counters
  • Optional: a toy keyboard, tablet, or computer with the screen turned off
  • Optional: stickers for encouragement

Learning Objectives

By the end of the lesson, the child will be able to:

  • Say that a computer follows instructions.
  • Sort simple messages into “friendly” and “strange.”
  • Explain that they should ask a trusted adult before clicking or typing something unfamiliar.
  • Create a simple pattern or set of instructions using objects or drawings.

Success Criteria

The child is successful when they can:

  • Tell one thing computers can do with instructions.
  • Correctly sort at least three example messages with help or independently.
  • Use the sentence: “I stop and ask a grown-up.”
  • Make and explain a simple two- or three-step pattern.

Introduction: The Computer Helper

Hook: Hold up a toy keyboard or point to a computer and ask:

“What do you think a computer does when we give it instructions?”

Say:

“Today we will be code detectives. We will learn that computers follow instructions, just like we follow directions. We will also learn what to do when a computer message looks strange.”

Child-friendly safety rule:

“If a message looks strange, we stop. We do not click or type. We ask a trusted grown-up.”

Body

I Do: Model Safe and Clear Instructions

Place three blocks in a row. Say each instruction slowly:

  1. “Pick up the red block.”
  2. “Put it beside the blue block.”
  3. “Count the blocks.”

Explain:

“An instruction tells us what to do. Computers use instructions, too. Clear instructions help computers do the right thing.”

Now give a silly or unclear instruction, such as:

“Put the block somewhere.”

Ask:

  • “Is that instruction clear?”
  • “What could we say to make it clearer?”

Model improving it:

“Put the yellow block on top of the green block.”

Quick Check

Ask the child to show thumbs up if an instruction is clear and hands on their head if it is unclear.

  • “Touch your nose.”
  • “Do something.”
  • “Put the blue counter in the cup.”

We Do: Friendly or Strange?

Place the three message cards where the child can see them. Explain:

“Some computer messages are friendly and easy to understand. Some messages look strange. When we see a strange message, we stop and ask a grown-up.”

Read one example at a time. Invite the child to place each one under the best card.

  • Friendly: “Would you like to draw a picture?”
  • Friendly: “Press the green button to play.”
  • Ask an Adult: “Type your secret password now.”
  • Ask an Adult: “Click this strange button to make everything disappear.”
  • Strange: A message made only of mixed-up symbols and words that do not make sense.

After each card, ask:

  • “What do you notice?”
  • “Would you click it?”
  • “Who could help you?”

Practice the safety response together:

“Stop, do not click, and ask a trusted grown-up.”

Think-Pair-Share or Talk Together

For a homeschool setting, the child can talk with the adult. For a classroom or training setting, the child can talk with a partner.

Ask:

“What would you do if a computer showed a message you did not understand?”

Help the child complete this sentence:

“I would stop and ask __________.”

You Do: Make a Code Pattern

Give the child blocks, counters, or buttons. Invite them to choose one of these challenges:

  • Make an AB pattern: red, blue, red, blue.
  • Make an ABC pattern: yellow, green, purple, yellow, green, purple.
  • Make a pattern with sounds: clap, tap, clap, tap.
  • Draw a pattern with shapes or colors.

Say:

“You are giving your pattern an instruction. Can I figure out what comes next?”

Let the child explain the pattern. Then follow the child’s instructions exactly. If the instruction is unclear, say:

“Please tell me one more step.”

Real-World Connection: Helpful Instructions

Explain that people use instructions in many places:

  • Following a recipe
  • Building with blocks
  • Washing hands
  • Crossing the street safely
  • Using a computer or tablet

Invite the child to choose one activity and give you three simple instructions. Follow the instructions carefully.

Assessment

Formative Assessment

Throughout the lesson, observe whether the child can:

  • Identify a clear instruction.
  • Explain why a strange message should not be clicked.
  • Name a trusted adult who can help.
  • Continue a simple pattern.

Give specific feedback:

  • “You noticed that message asked for private information. That was careful thinking.”
  • “Your instruction was clear because you told me what color block to use.”
  • “You remembered to stop and ask for help.”

Summative Demonstration

Ask the child to complete these four tasks:

  1. Tell what a computer does with instructions.
  2. Sort one friendly message and one strange message.
  3. Demonstrate what to do with a strange message.
  4. Create and explain a simple pattern.

Differentiation

Support for a Child Who Needs More Help

  • Use only two choices: Friendly or Ask an Adult.
  • Read all messages aloud.
  • Use pictures, colors, gestures, and repeated phrases.
  • Complete a two-object pattern instead of a three-object pattern.
  • Allow the child to point instead of giving a spoken answer.

Extension for a Child Ready for More

  • Ask the child to write or dictate three steps for a familiar task.
  • Invite the child to create a message that is safe, clear, and friendly.
  • Ask the child to explain why passwords and private information should be kept safe.
  • Let the child design a “computer safety poster” with the words: Stop, Check, Ask.

Conclusion: Tell What We Learned

Review the lesson using simple questions:

  • “What does a computer follow?”
  • “What do we do when a message looks strange?”
  • “Who can help us?”
  • “Can you show me your pattern one more time?”

Say:

“Today you learned that computers follow instructions. You learned that clear instructions help us. You also learned that when a message looks strange, we stop, do not click or type, and ask a trusted grown-up.”

Finish with the class safety chant:

“Stop! Check! Ask!”

Optional Follow-Up Activity

Invite the child to draw a friendly computer screen. The screen can show a safe message, a colorful pattern, and a trusted grown-up standing nearby. Ask the child to explain what is happening in the picture.


Ask a question about this lesson

Loading...

Related Lesson Plans

Boost Early Literacy Skills with Fun Vehicle-Themed Activities for Preschoolers: Learn Letters, Sounds, and Sight Words

Engage preschoolers in learning letters, sounds, and sight words like 'Stop' and 'Go' with this fun, vehicle-themed less...

Beginner's Guide to Block Coding: Create Your First Simple Game with Scratch

Learn the fundamentals of game creation with block coding! This easy-to-follow guide introduces beginners (kids and adul...

Historical Serial Homicide: Jack the Ripper, Society & Early Criminology

Explore the history of serial homicide before the modern term. Analyze the Jack the Ripper case to understand societal c...

Story Detectives: Fun Activity for Kids to Find the Main Idea in Books

Become a 'Story Detective'! Engage young children with this fun, easy activity using picture books, discussion, and draw...

Nature Detectives Preschool Lesson: Learn Beginning Sounds & Sight Words with Animal Tracks

Engage preschoolers and kindergartners with this fun 'Nature Detectives' lesson plan! Kids learn beginning letter sounds...

Play-Doh Letter Smash & CVC Word Building: Fun Activity for Early Reading Skills

Boost early literacy skills with this engaging Play-Doh activity! Learn how to use Play-Doh for letter recognition (smas...