You are on page 1of 61

​Grade 4

Computer Science Standards-Based Curriculum

Grade 4

Unit 1 
The World of Computing  

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4
v1.0, 2019

The World of Computing 


 
“We do not learn from experience. We learn from reflecting on experience.” John Dewey

Overview 

In this unit, students will learn the main computer parts and how they interact with each
other. Students will be introduced to Scratch and they will code their first projects involving
events, broadcast, and storytelling.

Students will practice debugging and writing test cases. They will also explore and practice
testing and debugging someone else’s program.

Students will gain an understanding of searching algorithms used by software and how they
compare to each other. Through an experiential exercise, they will identify which algorithm is
fastest.

Finally, students will gain an awareness of how computing technologies are changing our
world and how devices have changed the way we engage in a multitude of behaviors.
Students will practice brainstorming and expressing ideas of how devices can impact and
improve human lives.

Outline  Preparation 

Lesson 1.1​: How Does a Computer Work For all lesson plans, a classroom must
Lesson 1.2​: Getting Started with Scratch include:
Lesson 1.3:​ Your Wish Is My Command ❖ Computers connected to the internet to
Lesson 1.4:​ Testing and Debugging access scratch.mit.edu
Lesson 1.5:​ Searching Algorithms ❖ Projector and speakers for lesson
Lesson 1.6:​ Computing Technologies and the demonstration and videos
World ❖ Student reflection/design journal
Lesson 1.7:​ Assessment Exercises

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4
v1.0, 2019

Glossary
BIOS-​ Basic input/output system: The BIOS is software stored on a small memory chip. It
loads the operating system and interfaces the hardware components with the operating
system.
Binary search​ - A search algorithm that checks the middle item in a sorted set to identify
which half the search key is in. The process is repeated until the item is found.
Broadcast​ - ​A message that is sent from one party ​for anybody to listen to. You can decide to
hear it (passive) or to listen to it (active). Scratch uses the broadcast construct so that one
sprite can communicate with the other sprites.
CPU​ - Central Processing Unit - (The brain of the computer) The CPU reads and processes
instructions and sends signals to control other parts of the computer.
Debug​ - Find and remove problems in computer programs.
Electronic nose​ - A device intended to detect odors and through processing interpret
meaning of what the smell is or points towards.
Event​ - An event is an action that causes something to happen. Computers continually check
for actions that are events.
Hashing search​ - A search algorithm where the search key is manipulated to indicate exactly
where to find the information.
Linear search​ - A search algorithm that involves going through every item in a set one by one
until the item is found.
Memory​ - The storage space in the computer where data to be processed and the
instructions are stored.
Peripherals​ - A peripheral device is generally defined as any helper device such as a computer
mouse or keyboard that connects to and works with the computer in some way. Other
examples of peripherals are image scanners, tape drives, microphones, loudspeakers,
webcams, and digital cameras.
Program​ (Computer) - A list of instructions that tells the computer to perform a task and is
written in programming languages like Java, C++, and Python.
Test Case​ - A set of conditions under which a tester will determine whether a program being
tested satisfies requirements or works correctly.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4
v1.0, 2019

Alignment to Standards

California K-12 CS Standards


Identifier Concept Subconcept

3-5 CS.1 Computing Systems Devices

3-5 CS.3 Computing Systems Troubleshooting

3-5 AP.10 Algorithms and Programming Algorithms

3-5 AP.12 Algorithms and Programming Control

3-5 AP.14 Algorithms and Programming Modularity, Program Development

3-5 AP.17 Algorithms and Programming Program Development (Testing)

3-5 AP.18 Algorithms and Programming Program Development


(Collaborating)

3-5 IC.20 Impacts of Computing Culture (Computational)

CS K-12 Framework
Shorthand Concept Subconcept

3-5.Computing Computing Systems Devices


Systems.Devices

3-5.Computing Computing Systems Troubleshooting


Systems.Troubleshooting

3-5.Algorithms and Algorithms and Algorithms


Programming Programming
.Algorithms

3-5.Algorithms and Algorithms and Control


Programming Programming
.Algorithms

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4
v1.0, 2019

3-5.Algorithms and Algorithms and Modularity


Programming Programming
.Algorithms

3-5.Algorithms and Algorithms and Program Development


Programming Programming
.Algorithms

3–5.Impacts of Impacts of Computing Culture


Computing.Culture

Practices
Identifier Practice Statement

P2​.Collaborating Around Collaborating Around Cultivate working relationships


Computing.1 Computing with individuals possessing
diverse perspectives, skills, and
personalities.

P3​.Recognizing and Defining Recognizing and Defining Identify complex,


Computational Problems.1 Computational Problems interdisciplinary, real-world
problems that can be solved
computationally.

P3​.Recognizing and Defining Recognizing and Defining Decompose complex real-world


Computational Problems.2 Computational Problems problems into manageable
subproblems that could
integrate existing solutions or
procedures

P5​.Creating Computational Creating Computational Create a computational artifact


Artifacts.2 Artifacts for practical intent, personal
expression, or to address a
societal issue.

P5​.Creating Computational Creating Computational Modify an existing artifact to


Artifacts.3 Artifacts improve or customize it.

P6​.Testing and Refining Testing and Refining Systematically test


Computational Artifacts.1 Computational Artifacts computational artifacts by
considering all scenarios and
using test cases.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4
v1.0, 2019

P6​.Testing and Refining Testing and Refining Identify and fix errors using a
Computational Artifacts.2 Computational Artifacts systematic process.

P7​.Communicating About Communicating About Describe, justify, and document


Computing.2 Computing computational processes and
solutions using appropriate
terminology consistent with the
intended audience and purpose

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4
v1.0, 2019

Credits and References


This Unit used material and ideas from the following sources:

❏ “Electronic noses might replace search-and-rescue dogs”.


<​https://www.sciencenewsforstudents.org​ > June 2018
❏ “Inside your computer”, Bettina Bair. TedEd video.
<​https://www.youtube.com/watch?v=AkFi90lZmXA&feature=youtu.be&t=14​> Jul 1,
2013
❏ “Searching Algorithms, Battleships”, CSUnplugged
<​https://classic.csunplugged.org/searching-algorithms/#Battleships​>
❏ All images, unless cited otherwise, were obtained from the public domain.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 4

Lesson 1.1: How Does a Computer Work 

Objectives  Agenda 

In this lesson, students will: 1. How Does a Computer 10 mins


❖ Gain an understanding of the main Works
computer parts and how they 2. Main Computer Parts 30 mins
interact with each other. 3. Wrap Up and Reflections 10 mins

Preparation  Resources & Links 

❏ Projector and speakers for video ❏ Video link to “Inside your


and class activity Computer”:
❏ View the video on How the https://tinyurl.com/y64zhw7h
Computer Works.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4

1. How Does a Computer Work

Prompt​ students if they know any computer parts or components.

Explain​ that we are going to learn how computers work by studying different
components and concepts with weird names such as peripherals, BIOS, CPU, programs, and
memory.

Let’s start by watching a video: ​https://tinyurl.com/y64zhw7h

2. Main Computer Parts


Engage​ students in an interactive discussion and instruction of the main computer
parts and how they interact with each other:

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4

Peripherals

Think of peripherals as the stuff around the main computer. Sometimes peripherals are built
into the computer itself like the camera and microphone on a laptop or tablet.

They are divided into ​Input Devices​ and ​Output devices​. Input devices take in data from
outside the computer. Output devices convert information from the computer into physical
output.

What are some examples of input devices? ​ ​Microphones, keyboards, smartphone screens.
And output devices? Printers, monitors, smartphone screens.

BIOS (Basic Input/Output System)

The BIOS provides a way for the computer to interact with its
environment. It controls what and how much information comes in
and out. When something urgent needs attention, it interrupts the
CPU.

CPU (Central Processing Unit)

Think of the CPU as the brain of the computer. The CPU runs the
show: it fetches and runs programs, it stores data, it deals with input
and output devices, it changes data in memory.

When you run a Scratch project, the CPU runs your scripts.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4

Programs

Programs are a set of instructions that tell the


computer what to do. They are written in
programming languages the computer can interpret
or compile like Java, C++, Python, and Scratch.

Memory

Memory is the storage space in the computer where data to be


processed and the instructions are stored. When you create a
variable in Scratch, the value is stored in memory.

Credits​: Images from Ted Ed ​video “Inside Your Computer”, Lesson by Bettina Bair, animation by Flaming Medusa
Studios.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4

Engage​ students in the following quiz as an interactive class exercise. (Answers are at
the end to allow the quiz to be projected for the class to see).

1. The BIOS is most like the computer’s


A ​Brain
B ​Eyes and hands
C ​Stomach
D ​Lungs
E ​None of the above

2. The CPU can handle ________ of instructions a second


A ​Thousands
B ​Millions
C ​Billions
D ​Gazillions
E ​None of the above

3. Programs are encoded and stored in memory as


A ​1's and 0's
B ​Raw text
C ​HTML
D ​Electrons
E ​All of the above

4. The CPU’s job is


A ​To store information
B ​To deal with input and output from peripherals
C ​To edit files in memory
D ​To fetch and run instructions
E ​All of the above

5. The critical components of your computer’s architecture are:


A ​Wires, Plastic, Silicon
B ​Programs, Bits, Bytes, HTML
C ​Peripherals, BIOS, CPU, Programs, Memory
D ​Mouse, Motherboard, Integrated Circuits, Wires
E ​None of the above

6. Why are programs saved in a different format than the human readable programming
languages that they are written in?

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

Answers:

1. B ​Eyes and hands


2. C ​Billions
3. A ​1's and 0's
4. E ​All of the above
5. C ​Peripherals, BIOS, CPU, Programs, Memory
6. Human programs take up a lot of space and contain a lot of unnecessary
information to the computer; so they are compiled to make them smaller and
stored as bits of zeroes and ones in the computer memory

3. Student Activity: Input or Output Device?

This activity can be assigned as homework.

2. Student Journals
Introduce students to the idea of the design journal, a physical or digital notebook
where they can brainstorm ideas and share personal reflections, similar to a personal
journal or diary.

Explain that students will be prompted to update their design journals throughout their
Computer Science adventure, and encourage them to add to their journals anytime during the
process of learning about Computer Science. The design journal is a good place to capture
ideas, inspiration, notes, sketches, questions, frustrations, triumphs, etc.

3. Wrap Up and Reflections


Most lessons end with a set of reflection points. The paper and pen icon means to do these as
journal entries to encourage all students to participate.

Reflection Points as Journal Entries 

● In your journal, write 3 things you learned today.


● What else would you like to learn about computers?

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 4

Student Activity: Input or Output Device? 

Check ✔ the correct column to indicate if the device is an input or output device
Hint​: some rows may have 2 check marks.

Credits​: All images, unless cited, obtained from public domain.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
7
CSCL: Unit 1 Grade 4

Lesson 1.2: Getting Started with Scratch 

Objectives  Agenda 

In this lesson, students will: 1. Getting Started with 10 mins


❖ Be introduced to Scratch Scratch
❖ Learn and experience remixing a 2. Managing Your Students’ 15 mins
project in Scratch Scratch Accounts and
❖ Be introduced to journaling Projects.
❖ Engage in an exploratory coding 3. Remix a Project 10 mins
experience in Scratch 4. Student Activity: Create a 15 mins
Story

Preparation 
Resources & Links 
❏ Create a Scratch teacher account.
See appendix A for instructions. ❏ Scratch Teacher Account :
❏ View the Scratch teacher account https://tinyurl.com/yb4elakb
video.
❏ Scratch overview video:
❏ Create a Scratch ​class​ for your
https://tinyurl.com/m7ab2zp
students and optionally studios for
your students’ projects. ❏ Scratch backpack:
❏ Computers connected to the https://en.scratch-wiki.info/wiki/
internet Backpack
❏ Tell students to bring a journal (it
can be a notebook) to class

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 3

1. Getting Started with Scratch

This section is only necessary if any of your students have not used Scratch before.
Even if they have, it might be a good review.

Scratch is a programming language. You can program your own projects, share your projects
and get help from others by using other people’s code.

The following video gives a good introduction to Scratch:

https://tinyurl.com/m7ab2zp

It could be helpful to give a quick overview of how to code a couple of instructions to make the
cat move back and forth or as shown below make the cat move in a circle by clicking on the top
block of the script multiple times.

You may want to give a quick tour of the different sections of the Scratch tool such as:

1. The colored categories with blocks


2. The stage
3. How to create, name and save a project
4. How to create new sprites
5. How to delete blocks from the work area

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 3

2. The Scratch Backpack


Demonstrate​ the use of the Scratch ​backpack​ ​by placing scripts and entire sprites in
the backpack and retrieving them in a different project​ (click on the link for detailed
information about the Scratch backpack or go to
https://en.scratch-wiki.info/wiki/Backpack​)​. This is a very valuable tool to copy code between
projects and to save code or sprites in case of accidental deletion.

3. Managing Your Students’ Scratch Accounts and Projects:


It is recommended that you use a Scratch Class for your students which allows you to
create Scratch accounts for all your students. You will want to have your Scratch
Class, your students’ accounts and a studio created beforehand. See appendix A for
information on how to create a teacher account, students’ accounts, a class and
studio.

Tell your students what their usernames are or to choose one if they are not pre-assigned. It is
recommended that students write down their Scratch username in their design journal.

Show​ students how to sign into Scratch and how you want to manage their projects.

4. Remix a Project
Explain to students what it means to remix a project. Since students will be remixing starter
projects during the student activities, focus the demonstration on how to remix a project when
given a project number.

The alternate way to remix a project is while exploring existing projects in Scratch. Once a
project of interest has been found, you click on the project, then click on the green remix
button and save it with a new name.

Remixing a project given a project number:

1. Open a browser, go to scratch.mit.edu and sign in to your Scratch account.

2. Select an existing project in your account:

Point out the url in the browser ​specifically the project number shown in the red box
(your number will be different).

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 3

3. Replace the project number between the slashes with ​365519987​. Make sure that the
forward slashes (/) remain in place. If you double click on the project number, it is
selected and you can delete the previous one first. It is easy to make a mistake when
typing in a new project number.

Now the URL should be : ​https://scratch.mit.edu/projects/365519987/

Click ​enter​ (return key)

4. If the editor is not already open, click on “​See inside”​ ​in the upper right corner

3. Click on “​Remix”​ and ​save​ your project with a new name

4. Start working or exploring the new project or you can go back to the project page.

Tell students when they are working on a project to save it frequently. Remind
them also to save a remixed project and give it a meaningful name immediately
after remixing it. You may have to remind them to do this throughout the year.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 3

5. Student Activity: Create a Story

In this activity, students will create a story in Scratch by remixing a project, writing a
dialog and then coding the dialog in their project. Distribute the student activity and
explain the activity to them.
 
 
 
 
 
   

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 3

Student Activity: Create a Story 


 
What to do:  Using/Details: 

Remix​ and ​save​ this project giving it your 


326129743 
own name. 

Explore ​the sprites in the remixed 


project. 

Write your dialog for the characters in 


your ​design journal 

Watch the ​tutorial​ “Create a Story” 

Code your dialog​ in your project. 


 
Test​ and ​save​ your project often. 

 
Explore​ changing backdrops and adding 
another character. 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 3

Appendix A: Scratch Teacher Accounts and Scratch Classrooms

What are Scratch Teacher Accounts

A Scratch Teacher Account provides teachers and other educators with additional features to
manage student participation on Scratch, including the ability to create student accounts,
organize student projects into studios, and monitor student comments.

To request a Teacher Account, go to the teacher account ​request form​:


https://scratch.mit.edu/educators/register 

It takes up to 24 hours to get your teacher account approved.​ Once you have the account and
log in, you will see the purple banner with with the features only available to teacher accounts.

Creating Student Accounts, Classes and Studios

This video tells you just about everything you need to know about teacher accounts and how to
create classes and add students:

https://tinyurl.com/yb4elakb

Tips On Using Teacher Account Classes and Studios:

Classes​ allow you to manage your students’ accounts and projects.


Studios​ allow you to group and track projects for the Class.

Once you have your teacher account, you can create a ​Class​ as demonstrated in the video.
After you add your students to your class, you will be able to see all the activities of your
students, including when students:

❏ Love or Favorite a project


❏ Create a project
❏ Change their profile page
❏ Receive an alert and why
❏ Remove inappropriate comments

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
7
CSCL: Unit 1 Grade 3

❏ Unshare students’ projects


❏ Change a student’s password
You can change a student’s password in two ways. You can prompt the student to
change their password at the next login, or manually change their password.

Once you have a Class created, you can also create a class ​Studio​. Your students will be
automatically added as curators of the studio.
Studios can be used for a number of different reasons. It is a place where you can store a
collection of projects. For example, it can be used as a general space for your students to add
their completed projects, for a specific assignment, based around a particular theme, or even
used as a place to collect projects you are inspired by (among so many other possibilities).

Create studio with example projects, remixed projects (all projects that will be remixed by
students)

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
8
CSCL: Unit 1 Grade 4

Lesson 1.3: Your Wish Is My Command 

Objectives  Agenda 

In this lesson, students will: 1. Broadcasting 15 mins


❖ Learn the broadcasting concept and 2. Student Activity: Your 20 mins
practice using it in a Scratch project Wish Is My Command
❖ Revisit what an event is 3. Wrap Up and Reflections 15 mins
❖ Learn to customize a sprite

Resources & Links 


Preparation 
❏ Demonstration Project:
❏ Projector for project https://scratch.mit.edu/projects/2
demonstrations 84713454/editor/
❏ Become familiar with the
❏ Broadcasting Activity project:
Demonstration and Sample
https://scratch.mit.edu/projects/3
projects
26153011/editor
❏ Print student activity worksheet
one per student pair ❏ Sample Project:
https://scratch.mit.edu/projects/2
96093588/editor/

❏ Starter Project:
https://scratch.mit.edu/projects/2
96217899/editor/

❏ Pair programming video:


https://tinyurl.com/kuwoond

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4

1. Broadcasting

In this section you will review the concept of an event and introduce the concept of
broadcasting to students.

Open the following project in Scratch to help with the discussion and demonstration.
https://scratch.mit.edu/projects/284713454/editor/

Display your screen and engage​ students in an interactive demonstration and instruction.

Select the Abby Sprite to show Abby’s script and prompt a volunteer to read the code. Then
ask students to describe what programming concept is used in the code shown.

Answer​: The programming concept is an ​event​. An event is an action that causes something
to happen.

Prompt​ students to name the action and the “something​”​ that happens. (action: click on Abby;
the ​“​something​”​: say “​Everybody Move!​”​)

When we click on Abby on the stage, we want the cat and dog sprites to move. Do they move?
No. How can we do that? How does one sprite let the other sprites know it’s time to do
something?

In the media, when a program is broadcasted (on the radio, or TV, social media), it is sent from
one party for anybody to listen to. You can decide to hear it (passive) or to listen to it (active)

An example of a broadcast message in our daily lives could be a performer shouting to a crowd:
“Hello everybody!” . You can choose to say hello back or simply go on with what you were
doing.

In Scratch, sprites also communicate with each other using a broadcast message.
Demo​ adding the broadcast message:

To broadcast a message, you go to the ​Events​ category


and choose the “​broadcast”​ block. In the drop down
menu choose New Message and type in a message, ideally
one that makes sense. in the case of Abby, we will use
“​Move!​”

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4

Next, if a Sprite wants to listen to the message it adds a ​When I receive <message>​ ​event​.​ For
the ​Cat​ sprite, we add the following block to the script:

Click on Abby again to show what happens now.

What about the dog? It should move also.

Students will add the code for the dog in the next activity.

Remind​ students to be sure the message sent and listened to are the same.

Student Activity:

Instruct students to remix the following project and add the code to the dog sprite so it
also moves when we click on Abby.
Project​: ​326153011

2. Student Activity: Your Wish Is My Command!

In this activity students will work in pairs to code a project to practice using events and
broadcast messages.

Students are encouraged to work as a team with a partner, called pair programming. If
students are already familiar with the concept of pair programming, you may choose to skip the
next section. A review, however, could be beneficial.

Tell​ students they will be coding a project with a partner using events.

Pair Programming

When working on just about any project it is very helpful to have a partner to share
ideas, ask questions, help figure out a problem together or help each other when one
is stuck or does not understand something.

In many software companies like Google, Apple, Facebook and many more, computer scientists
use pair programming and team programming where several programmers work together on a
project. It would not even be possible to get most projects done without working in a team.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4

Let’s watch this video to learn how pair programming works: ​https://tinyurl.com/kuwoond

When working as a pair, only one student logs into their account. If both students
want to have the project in their Scratch account, tell students to share the project
when they are done and immediately have the other student remix it into their own
account.

Activity Description:

The project consists of giving a robot commands by clicking on various buttons that tell the
robot what to do. Students are provided with a starter project that includes 3 buttons. A
sample project is provided for you to demonstrate what the project is about.

Explain​ to students what they will be doing. ​Demo​ the sample project by running it and clicking
on the various buttons:
https://scratch.mit.edu/projects/296093588/editor/

If they finish coding the 3 buttons, tell students to add their own button with a new command.

Note:​ You may choose to demonstrate how to add text, change the color and move the
text inside a button sprite if students have not done this before.

Distribute the activity worksheet, one per student pair.

3. Wrap Up and Reflections

Remind​ students to share their project so partners whose account was not used can remix it
into their account. Tell students to save their project and sign out of Scratch!

Reflection Points:   

● What did you learn today?


● What is an event?
● How do sprites send messages to each other?
● What is a real life example of broadcasting?

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4

 
Student Activity Worksheet: Your Wish Is My Command! 
 
What to do:  Using/Details: 

Remix​ and ​save  296217899

Create a robot sprite 

When the robot sprite receives the broadcast​ m ​ essage 


“​Speak​”,​ add a ​say ​block to say something for 2 second 

The B
​ utton2​ sprite sends a Jump broadcast 
message. 
 
When the ​Robot​ sprite receives the “​Jump” 
broadcast​ ​message: 
the robot moves up (​change y by 60​) 
waits 0.4 seconds (so you can see it move) 
moves back down  

Add the script for the “​Dance”​ command. 


 
 
Extended Activity 

Add another button with a new command and write the scripts to do something new when 
the button is clicked. 
 
You can duplicate one of the other Button sprites 
and then change the command under the 
Costumes​ tab. 
 
Follow the directions to the right to change the 
text of your new button. 
 
 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

Lesson 1.4: Testing and Debugging 

Objectives  Agenda 

In this lesson, students will: 1. Debugging 5 mins


❖ Learn what test cases are and practice 2. Let’s Find Some Bugs ! 15 mins
writing test cases 3. Student Activity: What’s 10 mins
❖ Practice testing a program using test Wrong With This Talent
cases Show?
❖ Practice debugging somebody else’s 4. Student Activity: Let’s Fix 15 mins
program This Talent Show?
5. Wrap Up and Reflections 5 mins

Preparation 
Resources & Links 
❏ Projector and speakers for
demonstration ❏ Solution to Peter’s joke project:
❏ Become familiar with the https://scratch.mit.edu/projects/2
demonstration, the remix debug 1 96241615/editor/
and 2 projects.
❏ Student activity worksheet printouts ❏ Peter’s project with bugs:
one per student pair https://scratch.mit.edu/projects/2
96246955/editor/

❏ Talent Show remix for activity:


https://scratch.mit.edu/projects/2
96498608/editor/

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4

1. Debugging
It is very common for programs and code not to work the first time you try it.
When there is a problem in the code, programmers refer to it as a bug. Can
someone tell me why they are called bugs?

Program errors are called bugs because many years ago a very large computer called the Mark
II malfunctioned because they found a moth stuck inside the computer. Since then
programmers use the term debugging to remove bugs from programs.

Testing a program means running the program to check if there are any bugs in it.
Programmers spend a great deal of time testing and debugging code. That is why it is
important to develop good debugging strategies.

Today we are going to do some testing and debugging.

2. Let’s Find Some Bugs !

Tell students​:
Peter wrote a project in which Avery tells Devin a joke. Devin is listening and then
answers the question. When the joke is finished he starts laughing.

Open​ the following Scratch project and run it in full screen so students cannot see the scripts:
(click on )
https://scratch.mit.edu/projects/296246955/editor/

Hmmmm…. The project is not quite working as described. Peter must have made a couple of
mistakes. What is not working? Prompt students to call out what is actually happening that is
not as described.

Answer: 1) Peter talks at the same time as Avery instead of waiting for the question
2) He does not laugh at the end.

Student Activity:

In this activity students will fix Peter’s project. You may choose to do this as a class
activity or assign it as a student activity. Instructions:

❏ Remix Peter’s project: ​296246955


❏ Test his project and debug it so it works as described.
❏ There are 2 bugs in the project that need to be fixed.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4

Solution:​ Review the 2 bugs with students

Bug 1:

Devin does not wait long enough to talk, so he talks over Avery.
Avery first talks for 2 seconds, so Devin should wait 2 seconds, not 1.
Show the code for both and change Devin’s wait time to 2 seconds.
Test​ the code by running it again.

Bug 2:

After Avery finishes the joke, Devin does not laugh.


Devin’s is waiting to receive a message called
“Joke’s”. ​But Avery broadcasts a message called
“Joke Done”​.

Change Devin’s code to wait for the “​Joke Done”​ message.

Change the code and rerun the project to make sure


It works.

3. Student Activity: What’s Wrong With This Talent Show?

Student Activity:

Instructions to give to students:

In this next activity, you have been given the task to test a new program. Your job is to read
how the program is supposed to work. Then you will test the program and write down in your
journal all the bugs you find.

Distribute​ the activity worksheet. Students may work in pairs or on their own.
After the activity, ​prompt​ students for the bugs they found.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4

4. Student Activity: Let’s Fix that Talent Show


In this activity, students will fix the bugs they found in the previous activity. It is
recommended that the same teams work together.

Instruct​ students what to do. Follow-up the activity by reviewing the fixes to the bugs in the
program. There were a total of 3 bugs.

Solution:

Review the 3 bugs with students.

Bug 1:
After Bella sings, she does not leave the stage. A hide
command is missing
​Fix:​ Add a ​hide ​command at the end of the script.

Bug 2:

After Bella sings, there is no cheering ! The problem is that in the


Welcome​ sprite, the cheering code is listening to the “​Done”​ message.

But when Bella finishes singing, she broadcasts the “​Done


singing”​ message:

Fix: ​ After singing, the Bella sprite should broadcast the “​Done”
message.

Bug 3:

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4

When the Contestant 3 button is clicked, contestant 1, Diego, shows up again to dance.

The problem is that when the button is clicked, it broadcasts the message “​Contestant1”.
This is the wrong contestant.

Fix:​ Change the broadcast message to “​Contestant3”​ for the button sprite with the label
“Contestant 3”.

5. Wrap Up and Reflections

Reflection Points:   

● What is one thing you learned about testing?


● What is a programming bug?
● What does it mean to debug a program?
● Why is it important to have a good debugging strategy?

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

Activity Worksheet: What’s Wrong with this Talent Show? 

Description of the Talent Show Program: 

1. There are 3 contestants. When the green 


flag is clicked, the program introduces 
the show and each contestant by saying 
their name.   
You cannot see any of the contestants 
yet. 
 

2. For each contestant there is a button.   


When the button is clicked, the contestant 
shows up on the stage and performs the 
activity they announce they will perform. 
 

3. After the contestant finishes, you hear 


clapping and cheering. The contestant then leaves the stage. 
 

What to do: 

❏ Remix the following project. This is the talent show program. 

296498608 
❏ Test the program and write down each bug you find in your design journal. 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 4

Lesson 1.5: Searching Algorithms 

Objectives  Agenda 

In this lesson, students will: 1. Introduction 10 mins


❖ Gain an understanding of searching 2. Linear Search 10 mins
algorithms used by software 3. Binary Search 10 mins
❖ Discover and discern which 4. Hash Search 10 mins
algorithms are better and what a 5. Wrap Up and Reflections 10 mins
better searching algorithm means

Resources & Links 


Preparation 
❏ A Searching Algorithm Lesson
❏ Print student activity worksheets Plan:
(one per student, 1A’, 1B’, 2A’,... https://csunplugged.org/en/topics
are backups in case students /searching-algorithms/
accidentally see the location of their
partner’s ship; hence print a few
copies only)

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4

1. Introduction
Engage​ students in a brief introduction to searching algorithms:

Computers store a lot of information, and they need to be able to go through it


quickly. One of the biggest search problems in the world is faced by Internet search
engines, which must search billions of web pages in a fraction of a second.

There are different ways for a program to search for information. Today, we are going to
discover different algorithms to search for something and we will discover that some are better
than others.

Prompt​ students to the meaning of an algorithm. An algorithm is a list of steps to accomplish a


task.

What does it mean for one algorithm to be better than another in computer programming?
A better algorithm is one that requires fewer steps because then the computer has to do fewer
operations. When a computer has to do fewer operations it means the program will run faster
and use fewer resources.

Today, we are going to experience using different searching algorithms and discover which ones
require fewer steps.

2. Linear Search

Instructions to give to students:

1. Organise yourselves into pairs. One of you has sheet 1A, the other sheet 1B. Don’t show
your sheet to your partner!
2. Both of you circle one battleship on the top line of your game sheet and tell your
partner
its number.
3. Now take turns to guess where your partner’s ship is. (You say the letter name of a ship
and your partner tells you the number of the ship at that letter.)
4. How many tries does it take to locate your partner’s ship? This is your score for the
game.

Note:​ Sheets 1A' and 1B' are extras provided for children who would like to play more
games or who “inadvertently” see their partner’s sheet. Sheets 2A', 2B' and 3A', 3B' are
for the later games.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4

  Discussion Points:   

● What were the scores?


● What would be the minimum and maximum scores possible? (They are 1 and 26
respectively, assuming that the children don’t shoot at the same ship twice. This
algorithm is called ‘linear search’, because it involves going through all the positions,
one by one.)

3. Binary Search

Instructions to give to students:

1. Organise yourselves into pairs. One of you has sheet 2A, the other sheet 2B. Don’t
show your sheet to your partner!
2. Your ships and your partner’s ships are sorted in ascending order.
3. Both of you circle one battleship on the top line of your game sheet and tell your
partner its number. This is the number of the battle ship your partner must find. The
number that your partner gives you is the number of his battle ship you must find.
4. Now take turns to guess where your partner’s ship is. (You say the letter name of a
ship and your partner tells you the number of the ship at that letter.)
5. How many guesses does it take to locate your partner’s ship? This is your score for
the Game.

  Discussion Points:   

● What were your scores?


● What strategy did the low scorers use?
● Which ship should you choose first? (The one in the middle tells you which half of the
line the chosen ship must be in.) Which location would you choose next? (Again the
best strategy is always to choose the middle ship of the section that must have the
selected ship.)
● If this strategy is applied, how many guesses will it take to find a ship? (Five at most).
This method is called ‘binary search’, because it divides the problem into two parts.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4

4. Hashing Search

Instructions to give to students:

1. Each take a sheet 3A and 3B as in the previous games and tell your partner the number
of your chosen ship.
2. In this game you can find out which column (0 to 9) the ship is in. You simply add
together the digits of the ship’s number. The last digit of the sum is the column the ship
is in. For example, to locate a ship numbered 2345, add the digits 2+3+4+5, giving 14.
The last digit of the sum is 4, so that ship must be in column 4. Once you know the
column you need to guess which of the ships in that column is the desired one. This
technique is called ‘hashing’, because the digits are being squashed up (“hashed”)
together (like hash browns).
3. Now play the game using this new searching strategy. You may like to play more than
one game using the same sheet—just choose from different columns.

Note:​ ​ The spare sheets 3A' and 3B' must be used as a pair, because the pattern of
ships in columns must correspond.)

  Discussion Points:   

1. Collect and discuss scores as before.


2. Which ships are very quick to find? (The ones that are alone in their column.) Which
ships may be harder to find? (The ones whose columns contain lots of other ships.)

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4

5. Wrap Up and Reflections

Follow Up Discussion:   

● Which of the three searching algorithms is fastest? Why?


● What are the advantages of each of the three different ways of searching? (The
second strategy is faster than the first, but the first one doesn’t require the ships to be
sorted into order. The third strategy is usually faster than the other two, but it is
possible, by chance, for it to be very slow. In the worst case, if all the ships end up in
the same column, it is just as slow as the first strategy)
● Watch the following video: ​https://youtu.be/iDVH3oCTc2c​ . Which searching
algorithm was used?

For Your Reference: What’s it all about?


Computers store a lot of information, and they need to be able to sift through it quickly. One of
the biggest search problems in the world is faced by Internet search engines, which must search
billions of web pages in a fraction of a second. The data that a computer is asked to look up,
such as a word, a bar code number or an author’s name, is called a ​search key​.

Computers can process information very quickly, and you might think that to find something
they should just start at the beginning of their storage and keep looking until the desired
information is found. This is what we did in the Linear Searching Game. But this method is very
slow—even for computers. For example, suppose a supermarket has 10,000 different products
on its shelves. When a barcode is scanned at a checkout, the computer must look through up to
10,000 numbers to find the product name and price. Even if it takes only one thousandth of a
second to check each code, ten seconds would be needed to go through the whole list. Imagine
how long it would take to check out the groceries for a family!

For more in depth activities on linear search algorithm, check

https://csunplugged.org/en/topics/searching-algorithms/sequential-and-binary-search-unit-plan/ho
w-many-guesses/

A better strategy is ​binary search​. In this method, the numbers are sorted into order. Checking
the middle item of the list will identify which half the search key is in. The process is repeated

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

until the item is found. Returning to the supermarket example, the 10,000 items can now be
searched with fourteen probes, which might take two hundredths of a second—hardly
noticeable.

Additional activity:

https://csunplugged.org/en/topics/searching-algorithms/integrations/drama-video/

A third strategy for finding data is called ​hashing​. Here the search key is manipulated to indicate
exactly where to find the information. For example, if the search key is a telephone number,
you could add up all the digits in the number and take the remainder when divided by 11. In
this respect, a hash key is a little like a small piece of data whose value depends on the other
data being processed. Usually the computer will find what it is looking for straight away. There
is a small chance that several keys end up in the same location in which case the computer will
need to search through them until it finds the one it is seeking.

Computer programmers usually use some version of the hashing strategy for searching, unless
it is important to keep the data in order, or unless an occasional slow response is unacceptable.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 4

Student Activity Worksheets Follow

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
7
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
8
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
9
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
10
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
11
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
12
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
13
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
14
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
15
CSCL: Unit 1 Grade 4

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
16
CSCL: Unit 1 Grade 4

Lesson 1.6: Computing Technologies Are 


Changing the World 

Objectives  Agenda 

In this lesson, students will: 1. How Computing 10 mins


❖ Gain an awareness of how Technologies Have
computing technologies are Changed the Way We
changing our world. Live
❖ Be able to identify how specific 2. Student Activity: ​Student 10 mins
devices have changed the way we Activity: From ‘Happy
operate in the world. Birthday Dear Eric’ to
❖ Be able to brainstorm and express .
ideas of devices that can impact
and improve human lives. 3. Can a Mobile Device 10 mins
Know You Have a Cold?
4. Student Activity: Life 20 mins
Changing Electronic
Devices
Preparation  5. Wrap Up and Reflections

❏ Print student activity worksheet,


one per team of 2-3.
❏ Students will need their journal or
a piece of paper for the first Resources & Links 
student activity.
❏ Although the video content is more ❏ Video link as teacher
advanced, you may want to watch background/education (TEDx talk
the listed videos in resources as on electronic nose and disease
background information. detection - 10 mins long):
https://tinyurl.com/y26syys3

❏ How does an electronic nose work


video (1:22 mins):
https://tinyurl.com/y2ohhof2

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 6 Grade 4

1. How Computing Technologies Have Changed the Way We Live

Engage​ students in a teacher led discussion:

Technology has changed so many things we do almost on a daily basis, such as


making phone calls, communicating with others, traveling, watching movies,....

Note:​ ​ Some of the prior methods of doing things may need to be explained to
students that are not familiar with them such as film cameras.

Examples:

Activity Before Now

Watching Movies VCR, TV, DVDs Streaming Video

Phones Cable Home phones and Cell phone, Smart phone


rotary phones

Photos Load camera with film Smart phone

Written Communication Mailed letters, telegram. Text, Chat, Instagram

Driving Traditional car Self driving car

[​Prompt​ students to come up Further ideas after


with their own examples] students come up with
their own:

Written communication Handwritten Text, Chat, email


Navigation Paper maps GPS navigation
Games Board games Video games

2. Student Activity: From “Happy Birthday Dear Eric” to

Students discuss how written communication has changed the way people
communicate

Instructions to give to students:

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 6 Grade 4

1. In your team discuss how written communication has changed the way we
communicate. ​During the American Revolution, people sent letters to each other
which was slow and unreliable.​ The recipient would have to wait a few days to weeks
for a letter to arrive depending on the destination of the letter. Many people still
write letters, but it has mostly been replaced thanks to new technologies.

2. Discuss what types of written communication people use today and which
technologies have allowed this to change. Write down 2- 3 of your ideas.

3. Discuss and write down the benefits of the new way of communicating.

4. Be prepared to share your ideas with the class.

After the activity, ​prompt​ students to share their ideas with the class.

3. Can a Mobile Device Know You Have a Cold?

Dogs are some of our best friends. That’s especially true after a disaster, such as an
earthquake. When buildings collapse, search-and-rescue dogs help find people
trapped beneath the rubble. Dogs’ amazing noses can pick up the scent of survivors.
Dogs can also sniff hidden drugs and explosives.

Unfortunately, it is very
expensive to train a dog, they
may not always be up for the
task and they can’t work for
very many years.

Because smells can tell us so


much about ourselves and our
environment, scientists are
developing the sense of smell in
machines, sometimes called an
electronic nose. Lots of tiny
sensors are able to pick up
scents, process the information and decide what the smell is. These tiny sensors that ‘smell’
are small enough to fit inside a smartphone and other mobile devices, feeding information
about the scent to a computer system that can analyze the data and tell us what the scent is
of.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 6 Grade 4

These electronic noses will hopefully be able to be used to find survivors like dogs do, but
scientists are also developing them to detect diseases in humans. We might be able to
breathe into a smartphone or a handheld electronic device and it might be able to tell us if we
are sick. As one scientist put it, “Your phone might know you have a cold before you do.”

Optionally show​ the “How Does an Electronic Nose Work” video if appropriate for your class
(​https://tinyurl.com/y2ohhof2​).

4. Student Activity: Life Changing Electronic Devices

We learned how an electronic nose can be useful and how it might help in the
medicine field. What if we had an electronic eye device?

Students may work as a team or on their own for this activity (simply tell them to replace
‘our’ with ‘my’ if working alone).​ Explain the activity to students and distribute the activity
worksheet.

Allow​ time for students to share and discuss their ideas with the class.

5. Wrap Up and Reflections

Reflection Points:

● How is technology changing the way we live?


● Do you think technology is making our lives easier or harder?
● How are our lives different because of technology?

   

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 6 Grade 4

 
Student Activity: Life Changing Electronic Devices 
You learned about an electronic nose. Now you will share your own invention! Be 
prepared to share with the class. Every team member will share at least one 
item. 
 
What to do: 
 
1) Your team had an amazing breakthrough and your new 
electronic eye is ready to see where no eye has seen 
before! 
  
Our electronic eye is called ______________________ 
 
Our electronic eye can see (examples: in the dark, x number of feet away, in 
certain places where it is difficult to see,.....) 
 
_________________________________________________________ 
 
_________________________________________________________ 
 
People can use our device to ____________________________________ 
 
_________________________________________________________ 
 
_________________________________________________________ 
 
Our eye can solve the following problem(s) _________________________ 
 
_________________________________________________________ 
 
_________________________________________________________ 
 
_________________________________________________________  
 
 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

Lesson 1.7: Assessment Exercises 

Objectives  Agenda 

After completing this lesson, students will: 1. Student Activity 30 mins


❖ Have an understanding of how much 2. Review Activity Solutions 20 mins
they learned and understood during and Wrap Up
Unit 1

Resources & Links 


Preparation 
❏ None
❏ Print student activity worksheet
(one per student)

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
1
CSCL: Unit 1 Grade 4

1. Student Activity: Assessment Puzzles


Distribute one worksheet per student. This is an assessment activity for material covered in
Unit 1. Explain the activity to students. Leave enough time at the end to go over the answers.

2. Review Activity Answers

Engage​ students in an interactive discussion and review of the answers to each of the
exercises.

Solution to Student Activity:

1. Check everything that is true about computer programs;


✅They are stored as bits of 0s and 1s
✅They are written in programming languages the computer can interpret
✅They tell the computer what to do
❏ They can’t be longer than 1 million instructions

2. Circle all items that are an​ input device​:

3. The CPU’s job is to fetch and run instructions and is most like the computer’s lungs.

False​ ​Explanation​: While it is true that the CPU fetches and runs instructions, the CPU
is most like the computer’s brain.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
2
CSCL: Unit 1 Grade 4

4. Draw a line connecting the old way of doing things to the new way today

5. To debug means:
a. Wipe bugs off a computer screen
b. Run a test case

✅c. Write a program with no bugs


d. ​ Find and remove problems in a program

6. When one sprite wants to send other sprites a message, it _________________ a


message. (Fill in the missing word).

​Broadcasts

7. Computers often need to search for a single item in a set of data. There are many
searching algorithms.

When a program first sorts the data and then checks the middle of the list to check
which half the item is in and repeats this until the item is found it is called:

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
3
CSCL: Unit 1 Grade 4

a. Linear search

✅ b.
c.
​d.
Hashing search
Binary search
Middle search
e. It has no name
8. The linear search is the fastest searching algorithm for lots of data because you don’t have
to sort the data first.

False

The hashing algorithm would be the fastest.

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
4
CSCL: Unit 1 Grade 4

Student Activity: Check Your Knowledge 


1. Check everything that is true about computer programs; 
❏ They are stored as bits of 0s and 1s 
❏ They are written in programming languages the computer can interpret 
❏ They can’t be longer than 1 million instructions 
❏ They tell the computer what to do 
 
 
2. Circle all items that are an​ input device​:

3. The CPU’s job is to fetch and run instructions and is most like the computer’s 
lungs.   
❏ True   
❏ False 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
5
CSCL: Unit 1 Grade 4

4. Draw a line connecting the old way of doing things to the new way today 
 

5. To debug means: 

a. Wipe bugs off a computer screen 

b. Write code with bugs in it 

c. Write a program with no bugs 

d. Find and remove problems in a program 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
6
CSCL: Unit 1 Grade 4

6. When one sprite wants to send other sprites a message, it  

_________________ a message. (Fill in the missing word). 

7. Computers often need to search for a single item in a set of data. There are 
many searching algorithms.   

When a program first sorts the data and then checks the middle of the list 
to check which half the item is in and repeats this until the item is found it 
is called: 

e. Linear search 
f. Hashing search 
g. Binary search 
h. Middle search 
i. It has no name 

8. The linear search is the fastest searching algorithm for lots of data because 
you don’t have to sort the data first. 

❏ True   
❏ False 

© ​Code for fun


Released under the ​Creative Commons By Attribution​ license
7

You might also like