Code Detectives: Fun Coding and Computer Safety Lesson for Kids

Help children explore letters, numbers, symbols, patterns, and pretend secret codes with this engaging coding lesson. Kids learn to identify computer messages, sort safe and unsafe instructions, and practice the important rule: stop, look, and ask a grown-up before clicking.

Previous Lesson
PDF

Code Detectives: Exploring a Silly Secret Computer Message

Materials Needed

  • Large paper or a whiteboard
  • Crayons or washable markers
  • Building blocks or counting bears
  • Index cards or small pieces of paper
  • Two baskets labeled “Safe to Try” and “Ask a Grown-Up”
  • A toy computer, tablet, or pretend keyboard
  • Optional: a timer, stickers, and play coins

Learning Objectives

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

  • Notice and describe patterns, symbols, numbers, and letters.
  • Explain that some computer messages are instructions.
  • Sort pretend computer instructions into “safe to try” and “ask a grown-up.”
  • Create a simple, safe secret message using pictures, letters, or numbers.
  • Tell one way to use a computer safely.

Success Criteria

I can:

  • Point to or name at least three parts of a strange message.
  • Follow a simple pattern or instruction.
  • Ask a grown-up before trying an unknown computer command.
  • Make and explain my own safe secret message.

Introduction: The Mystery Message

Hook: Show the child this unusual string of symbols:

10'XOR(1*if(now()=sysdate(),sleep(38.916),0))XOR'Z

Say:

“Look at this funny computer message! It has numbers, letters, marks, and parentheses. Does it look like a sentence, a recipe, or a secret code?”

Explain in simple language:

“This is a computer-like message. Some computer messages tell a computer what to do. We will not put this message into a real computer because we do not know exactly what it might do. We can safely look at its shapes and make our own pretend code.”

Tell Them What We Will Learn

“Today we will be code detectives. We will find letters, numbers, and symbols. We will practice following safe instructions, and we will make a secret message that only our helper can read.”

Body: I Do

1. Notice the Parts of the Message

Point to different parts of the message and name them:

  • 10 — “These are numbers.”
  • XOR — “These are letters. They are often used as a computer word.”
  • ( ) — “These are parentheses. They look like a mouth or a hug.”
  • ' ' — “These marks can show words or text.”
  • = — “This is an equal sign. It means two things match.”

Say:

“A computer can read tiny marks very carefully. People can look for patterns and decide what is safe.”

2. Model Safe and Unsafe Choices

Show two pretend cards:

  • Safe card: “Press the blue button to play a song.”
  • Ask card: “Run this strange message you do not understand.”

Think aloud:

“I know the first instruction because a grown-up showed me the button. I do not know what the strange message will do, so I will stop and ask a grown-up.”

Teach the safety rule:

Stop, look, and ask before trying an unknown computer message.

Body: We Do

3. Symbol Detective Game

Work together to find and count parts of the message.

  1. Circle or point to all the numbers.
  2. Tap each letter in XOR.
  3. Make a “hug” shape with your arms like the parentheses.
  4. Clap when you see a symbol such as =, *, or '.

Ask:

  • “Which part looks like a number?”
  • “Which mark looks like a hug?”
  • “Do we know what the whole message will do?”
  • “What should we do when we are unsure?”

4. Safe-to-Try Sorting Game

Read each pretend instruction aloud. The child places it in the correct basket.

Instruction Expected Basket
“Draw a happy face on paper.” Safe to Try
“Press a button that your grown-up says is okay.” Safe to Try
“Type a strange message from a stranger.” Ask a Grown-Up
“Tell someone your password.” Ask a Grown-Up
“Build a tower with three blocks.” Safe to Try

Quick check: Hold up a card and ask, “Safe to try, or ask a grown-up?” Invite the child to explain why.

Body: You Do

5. Make a Pretend Secret Code

Let the child choose one of these options:

Option A: Picture Code

  1. Choose three pictures, such as a star, heart, and sun.
  2. Give each picture a meaning.
  3. Draw a short message using the pictures.
  4. Ask the grown-up to guess the message.

Example:

  • Star = “Hello”
  • Heart = “I like you”
  • Sun = “Have a happy day”

Option B: Block Code

  1. Choose a block color for each action.
  2. Red = stop, blue = clap, yellow = jump.
  3. Build a color pattern.
  4. Have the grown-up follow the pattern.

Option C: Letter-and-Number Code

  1. Write the first letter of three favorite things.
  2. Put a number beside each letter.
  3. Read the message together.

Remind the child:

“Our code is pretend and safe. We do not use secret codes to hide passwords or important private information.”

6. Real-World Practice: Ask Before You Click

Use the toy computer or pretend keyboard. Act out this situation:

“You see a button that says, ‘Click me for a surprise!’ What do you do?”

Guide the child to say:

“I stop and ask my grown-up first.”

Repeat with different scenarios:

  • A video asks for your name.
  • A game asks for a password.
  • A message comes from someone you do not know.
  • A grown-up shows you a safe drawing app.

Formative Assessment

  • Listen for the child’s ability to identify letters, numbers, and symbols.
  • Observe whether the child follows a two- or three-part pattern.
  • Ask the child to sort at least three instruction cards.
  • Ask, “What do you do when a computer message is strange?”
  • Give specific feedback, such as: “You noticed that the message had numbers and letters,” or “You remembered to ask before clicking.”

Summative Assessment: Code Detective Demonstration

Invite the child to complete these three tasks:

  1. Point to one number, one letter, and one symbol in the sample message.
  2. Sort one safe instruction and one unknown instruction.
  3. Create a small secret message and explain what it means.

The child demonstrates success by completing at least two tasks independently and completing the remaining task with a little help.

Differentiation and Adaptations

For a Child Who Needs More Support

  • Use only two symbols at a time.
  • Offer picture choices instead of requiring spoken answers.
  • Count or identify one part of the message at a time.
  • Use large cards with clear colors and shapes.
  • Repeat the safety phrase: “Stop, look, and ask.”

For a Child Ready for More Challenge

  • Create a four-part pattern for someone else to follow.
  • Invent a symbol dictionary with five symbols.
  • Explain why a strange computer instruction should not be tried without help.
  • Write a short safe instruction, such as “Clap two times.”
  • Compare the sample message with a regular sentence and describe two differences.

Different Learning Settings

  • Homeschool: Use household objects, toys, or a pretend computer.
  • Small group: Let children take turns being the code maker and code follower.
  • Online: Use a shared whiteboard, spoken patterns, and paper cards held up to the camera.
  • Training context: Replace the pretend computer with a safe workplace example, such as asking before opening an unfamiliar file.

Conclusion: Recap and Reflection

Ask the child to finish these sentences:

  • “A computer message can have _____.”
  • “One symbol I noticed was _____.”
  • “When I see a strange computer message, I _____.”
  • “My secret code means _____.”

Recap:

“Today we looked at a funny computer-like message. We found letters, numbers, and symbols. We learned that unknown computer instructions should not be tried alone. We stop, look, and ask a grown-up. We also made our own safe pretend code.”

Optional Follow-Up Activity

During the week, make a “safe instruction hunt.” Find safe instructions in daily life, such as “wash hands,” “put toys away,” or “press the play button with permission.” Draw each instruction and mark it with a green check. Add any unknown computer instruction to an “Ask a Grown-Up” list.


Ask a question about this lesson

Loading...

Related Lesson Plans

How to Roller Skate for Beginners: Easy Step-by-Step Lesson on Safety, Balance, Gliding & Stopping

Master the roller skating basics with our easy-to-follow guide for beginners! Learn essential safety tips, how to balanc...

Body Safety Lesson Plan for Kids: Teaching Safe Touches & 'No, Go, Tell'

Empower young children with this comprehensive lesson plan on personal body safety. Perfect for parents and educators, t...

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...

Fun T-Ball Lesson Plan for Kids: Hitting Drills, Stance & Safety

Teach kids the fundamentals of T-ball with this fun lesson plan! Perfect for beginners (K-2), it covers batting stance, ...

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...