Code Pro Lesson Plan Code Like a Pro!
Lesson Plan: Fundamentals of Computer Science
Duration 90 Min
Audience
Middle School
Approach
Hands-on / Interactive
Objective
Sequence, Loops, & Conditionals
Teacher Prep
• Review Lesson Plan, Script, and all slide content.
• Ensure projector and whiteboard are functional.
• Print copies of Unplugged Coding Activity and Code Your Name Worksheet .
• Prepare Debug the Bug Game materials (printed sheets or projected snippets).
Estimated Prep: 30 minutes
Materials
Whiteboard & Markers
Projector
Student Worksheets
Slide Deck
Writing Utensils
Why this lesson?
Understanding coding is crucial in our technology-driven world, equipping students with valuable skills for future careers and everyday problem-solving. This lesson aims to spark their interest and build a foundational understanding of computational logic.
Instructional Sequence
10m
Warm-Up: Code Scramble!
Project the warm-up and ask students to arrange steps to make a PB&J sandwich in the correct order. Discuss why precise sequence matters.
20m
Direct Instruction: Coding Concepts
Present the Introduction to Coding Slide Deck . Introduce Sequence, Loops, and Conditionals using real-world analogies. Use interactive prompts to check comprehension.
25m
Activity: Unplugged Coding
Distribute Unplugged Coding Activity . Students program "Botty" the robot through grids using basic commands. Focus on applying loops and conditionals without technology.
15m
Application: Code Your Name
Students translate their names into a series of "write" and "logic" commands. Encourages creative application of structured logic.
10m
Game: Debug the Bug
Challenge students to identify and fix errors in simple logic snippets. Emphasize that debugging is a fundamental part of the engineering process.
10m
Assessment & Wrap-Up
Administer the Coding Challenge Quiz (5m) and conclude with the One Big Takeaway cool-down as an exit ticket.
Introduction to Coding Slide Deck Welcome to the World of Code!
What do you think coding is?
How does code impact your daily life?
What is Coding?
1
Coding is like writing a recipe for a computer.
2
It's giving a computer instructions to perform a task.
Computers need very specific, step-by-step instructions!
Apps & Sites
Games
Robots & AI
Self-Driving Cars
Why Learn to Code?
Solve problems like a detective!
Think logically and break down challenges.
Be creative and build amazing things.
Understand the digital world around you.
Concept 1: Sequence
Sequence is the order in which instructions are executed.
Discussion Question:
What happens if you change the order of a recipe?
Example: Brushing Teeth
1 Pick up toothbrush
2 Put toothpaste on brush
3 Brush teeth
4 Rinse mouth
Concept 2: Loops
Loops are used to repeat instructions multiple times.
Why use them?
Saves time
Less typing
Avoids mistakes
The Hard Way
Walk one step forward.
Walk one step forward.
Walk one step forward.
The Pro Way (Loop)
REPEAT 3 TIMES:
Walk one step forward.
Concept 3: Conditionals
Conditionals allow computers to make decisions.
IF light is green THEN:
Cross the street
ELSE:
Wait at the curb
Your Turn!
What other "If... Then..." situations do you use every day?
If it's raining, then...
If the alarm goes off, then...
Quick Review & Challenge!
The Boss Challenge
How would you code a robot to pick up 5 apples,
but ONLY if they are red?
Sequence
Loops
Conditionals
Code Like a Pro Script Code Like a Pro! Script
Instructional Facilitation Guide for a 90-Minute Introduction to Coding
10 Minutes
Part 1: Warm-Up: Code Scramble!
Teacher: "Good morning, everyone! Let's kick off our coding adventure with a fun warm-up called 'Code Scramble!' On your desks, you'll find a worksheet with steps for making a peanut butter and jelly sandwich. But there's a catch – they're all mixed up! Your first task is to put those steps in the correct order, from 1 to 7, to make a perfect PB&J. Go ahead and start arranging them now."
Allow students a few minutes to work individually or in pairs. Circulate and observe.
Teacher: "Alright, let's see how our coding minds did! What was the first step you put down? [Call on a student]. Why that one? What's next? [Continue calling on students to build the correct sequence]."
"Great job! Now, for the bonus question: Why is the order of these steps so important? What would happen if you did them in a different order? [Facilitate a brief discussion, highlighting that incorrect order leads to a messy or unmade sandwich, just like with computer code]. This concept of order is super important in coding, and it's called sequence !"
20 Minutes
Part 2: Introduction to Coding Concepts
Slide 1-3: Introduction
"Welcome to the world of Code! When you hear the word 'coding,' what comes to mind? Shout out some ideas! How does code already impact your daily life, even if you don't realize it? Simply put, coding is like writing a recipe for a computer. It's giving a computer instructions to perform a task. But here's the key: computers need very specific, step-by-step instructions. They can't guess what you mean!"
Slide 4: Sequence
"Let's dive into our first core coding concept: Sequence . As we saw with our PB&J, sequence is simply the order in which instructions are executed. If you're brushing your teeth, you first pick up the toothbrush, then put toothpaste on it. What happens if you try to rinse before putting toothpaste on? Exactly! The order matters for the outcome!"
Slide 5: Loops
"Next up are Loops . Imagine I told you to walk one step forward, then walk one step forward... three times. That's a lot of repeating! In coding, we use a loop to save time. Instead of saying 'Walk forward' three times, we say: 'Repeat 3 times: Walk forward.' Loops make our code much more efficient."
Slide 6: Conditionals
"Our third big concept is Conditionals . Conditionals allow computers to make decisions. Think about crossing the street: 'IF the light is green, THEN cross the street. ELSE, THEN wait.' What other 'If... Then...' situations do you know from your everyday life?"
Code Scramble Warm Up Code Scramble!
Name
Date
Mission: The Perfect PB&J
The steps below for making a peanut butter & jelly sandwich are all mixed up! Your task is to put them in the correct order (1-7). Write the correct number in the circle next to each step.
?
Spread peanut butter on one slice of bread.
?
Put the two slices of bread together.
?
Get two slices of bread.
?
Take out peanut butter and jelly.
?
Eat your delicious sandwich!
?
Spread jelly on the other slice of bread.
?
Use a knife to spread.
Bonus Thinking Challenge
Why is the order of these steps so important? What would happen if you did them in a different order?
Unplugged Coding Activity Unplugged Coding Adventure
Mission: Robot Navigation
Programmer
Meet Botty
Botty is a simple robot. Your job is to write instructions (code) to help Botty reach the target.
Botty's Commands
MOVE FORWARD
REPEAT [n] TIMES:
TURN RIGHT / LEFT
IF [condition] THEN:
PICK UP OBJECT
Example: IF OBSTACLE THEN:
1
The Straight Path
Focus: Simple Sequence
S
T
MOVE FORWARD
2
The Right Turn
Focus: Sequence & Turns
S
T
3
The Repeating Path
Focus: Loops (REPEAT command)
S
T
REPEAT _____ TIMES:
4
The Fork in the Road
Focus: Conditionals (IF...THEN)
S
T
IF OBSTACLE THEN:
5
The Obstacle Course
Ultimate Challenge: Combine Everything!
Mission Map
S
T
Star (Collect)
Obstacle
// Write your code for Challenge 5 below
Code Your Name Worksheet Code Your Name
Programming with Personal Syntax
Name
Date
"Imagine you are a computer. To spell your name, you must execute a sequence of specific commands. Use the 'logic' and 'movement' commands below to build your personal script."
Available Commands
WRITE [Letter]
Outputs a character to the screen.
MOVE CURSOR [RIGHT/LEFT]
Shifts the input focus.
NEW LINE
Drops to the next row.
PAUSE [n] SECONDS
Wait before the next command.
IF [Letter] IS [Vowel/Consonant] THEN: [Action]
Conditional logic check.
Example: EVA
WRITE E
MOVE CURSOR RIGHT
IF 'V' IS CONSONANT THEN: PAUSE 0.5s
WRITE V
MOVE CURSOR RIGHT
IF 'A' IS VOWEL THEN: PAUSE 1s
WRITE A
Tip: Try to use at least one IF statement in your code!
My Target Name
Pro Challenge
Can you add a LOOP for repeating letters or code your full name below?
Debug the Bug Game Debug the Bug!
Official Coding Detective Mission
Detective Assigned
Case Briefing: In the world of coding, programs rarely work perfectly the first time. Sometimes there are bugs – errors that cause unexpected behavior. Your mission is to find the bugs in the code snippets below, fix them, and explain your reasoning.
01
The Mixed-Up Morning Routine
Sequence Bug
Buggy Snippet
1. Add milk to bowl.
2. Get a spoon.
3. Pour cereal into bowl.
4. Eat cereal.
Outcome needed: A perfect bowl of cereal without a mess!
Identify the Bug
Corrected Code
1. ________________________
2. ________________________
3. ________________________
4. ________________________
5. ________________________
Why does this fix it?
02
The Endless Walk
Loop Bug
Buggy Snippet
REPEAT FOREVER:
MOVE FORWARD
Outcome needed: The robot should take exactly 3 steps forward.
Identify the Bug
Corrected Code
Why does this fix it?
03
The Cold Decision
Conditional Bug
Buggy Snippet
IF temperature > 60 THEN:
WEAR JACKET
ELSE:
WEAR T-SHIRT
Outcome needed: If the temperature is below 60, wear a jacket. Otherwise, wear a t-shirt.
Identify the Bug
Corrected Code
Why does this fix it?
End of Mission. Status: Awaiting Debugging.
Coding Detective Certified
Coding Challenge Quiz Coding Challenge Quiz
Topic: Programming Logic Fundamentals
Name
Date
Read each question carefully. Select the best answer for multiple-choice questions.
1
Which of the following best describes 'sequence' in coding?
Repeating a task many times
Making a decision based on a condition
The order of steps in a program
Finding an error in code
2
What is the purpose of a 'loop' in coding?
To stop a program
To repeat a set of instructions
To write new instructions
To change the order of steps
3
An 'IF...THEN' statement is an example of what coding concept?
Sequence
Loop
Conditional
Debug
4
Imagine you want a robot to clap its hands 5 times. Describe how you would use a 'loop' command to do this.
5
Why is 'debugging' an important part of coding?
Introduction to Coding Test Introduction to Coding Test
Mastering the Logic: Sequence, Loops, & Conditionals
Student
Score
/ 100
Part 1: Foundational Concepts
Which term describes the specific order in which a computer executes instructions?
Loop
Conditional
Sequence
Variable
What programming concept allows a set of instructions to be repeated multiple times without writing them out individually?
Sequence
Loop
Conditional
Function
An IF temperature < 32 THEN: TURN ON HEATER ELSE: TURN OFF HEATER statement is an example of what coding concept?
Sequence
Loop
Conditional
Algorithm
Part 2: Applied Logic
Explain in your own words what a 'bug' is in computer programming and why it's important to 'debug' code.
You want to program a robot to walk 5 steps forward, then turn right, then walk 2 steps forward. Write the sequence of commands, using a loop if possible.
1. __________________________________________________________________
2. __________________________________________________________________
3. __________________________________________________________________
4. __________________________________________________________________
5. __________________________________________________________________
Describe a real-world scenario where a conditional statement (If...Then...Else) is used to make a decision.
Which of these is NOT a direct benefit of learning to code?
Improved problem-solving skills
Enhanced logical thinking
Better understanding of digital technology
Becoming a professional gamer
Rewrite this inefficient code more efficiently using a loop to make a light blink 3 times:
TURN LIGHT ON
TURN LIGHT OFF
TURN LIGHT ON
TURN LIGHT OFF
TURN LIGHT ON
TURN LIGHT OFF
Answer Key: Coding Basics Answer Key: Coding Basics
Teacher Resource: Assessment & Worksheet Solutions
Coding Challenge Quiz
1. Sequence Definition
Answer: The order of steps in a program
Explanation: Sequence refers to the specific, step-by-step order in which instructions are given and executed. If the order is wrong, the program might not work as intended.
2. Loop Purpose
Answer: To repeat a set of instructions
Explanation: Loops are used to efficiently execute the same block of code multiple times, avoiding repetitive writing.
3. IF...THEN Statements
Answer: Conditional
Explanation: Conditionals allow a program to make decisions and execute different code paths based on whether a certain condition is true or false.
4. Loop Application (Robot Clapping)
Example: I would use a `REPEAT 5 TIMES:` loop. Inside the loop, I would put the command `CLAP HANDS`.
Rubric: Look for the mention of a repetition count (5) and a specific action (Clap) being nested within the repeat structure.
Introduction to Coding Test
Q1: Order
Sequence
Q2: Repeat
Loop
Q3: If...Then
Conditional
4. Defining 'Bug' & 'Debug'
"A 'bug' is an error or mistake in code that causes a program to not work correctly or as expected. It's important to 'debug' because without finding and fixing these errors, the program won't run properly and might produce incorrect results or crash."
Rubric: Must identify bug as an error and debug as the fix process.
5. Robot Navigation Commands
1. REPEAT 5 TIMES:
MOVE FORWARD
2. TURN RIGHT
3. REPEAT 2 TIMES:
MOVE FORWARD
Rubric: Accept simple sequences (5 forward moves) but award bonus for loop use.
8. Rewriting Blink Loop
REPEAT 3 TIMES:
TURN LIGHT ON
TURN LIGHT OFF
Explanation: Correct identification of the repeating pattern (ON + OFF) within the loop.
Confidential Teacher Resource • Do Not Distribute to Students
One Big Takeaway Cool Down One Big Takeaway
Lesson Reflection & Exit Ticket
Exit Ticket
The Mission Briefing
Before you log off today, take a moment to reflect on everything we covered—from making PB&J sandwiches to programming "Botty" the robot.
What is ONE thing you learned today that you found interesting, surprising, or important?
Programmer Name
Session Date