Advanced

Fourth Grade


Programming concept covered:

Object-Oriented Programming: Classes

Time: 45-55 minutes

Lesson Materials

  • Activity image cards
  • Floor space
  • Colored tape or items to mark floor space with lines
  • Kodable on-screen (web, desktop, iPad, or Android)
    Available at Kodable.com/download
Download Teaching Materials

Print Lesson Plan

Get a free teacher account

Objectives


  1. Students will be able to recognize similarities and differences between objects and group them accordingly.
  2. Students will be able to define Object-Oriented Programming.
  3. Students will be able to identify classifying objects as part of Object-Oriented Programming.

Vocabulary


  • Program: A set of instructions (given to a computer in code from a programmer) that performs a specific task when carried out by a computer.

  • Code: The language that programmers use and create to tell computers what to do.

  • Command: Instruction given by a person (programmer) that tells a computer to do something.

  • Object-Oriented Programming(OOP): Object-oriented programming is a programming language model; it is NOT a programming language. OOP categorizes pieces of code into separate objects which each have their own defined set of tasks in a program.

  • Class: A class is a definition for a specific object and represents a group of similar things. In OOP, a class is like a blueprint that individual objects are created from.

  • Object: An object is a living “creation” of a class. A class is just a blueprint or template to create something from; an object actually exists and has features.
    Examples: a character in a game, a Kodable fuzz, an arrow command in Kodable, a spaceship, the Kodable World planets, etc.

  • Inheritance: Features passed down from a main class, or parent class.

  • Subclass: A subclass is a class of objects that inherit certain features from another class.

Direct Instruction (I do)


Review:
Review what a program is, how programs run effectively (sequence), what a programmer does, and how code allows programmers to communicate with computers.
Talk about elements of programming that allow programmers to save time and build more complex, dynamic programs (loops and functions). Review variables and how code impacts what a user sees on the other end of the machine when they use a website or an app (strings, integers, arrays).

Introduce:
T (say): “This is all done ‘behind the scenes’ and the only one who sees this code is the programmer. When we play a game or visit a website we don’t see code or the communication happening between the program and the computer. We’re going to learn about how code allows us to interact with computers so we can access information on websites, play games, and use technology to help us complete tasks. Today, we’re going to be focusing on games as an example.

Think, Pair, Share

“Think about your favorite game- either on an iPad, computer, game system, or another device. What does the player see on the screen? Are there characters? What is the setting like? What objects are in the game? Is like the real world or is it a fictional world? Turn and describe it to your partner.”

T (say): “We’re going to connect the real world to how programmers write the code to create games like all of your favorites.

The world is similar to a giant collection of objects. Some of these objects are similar to each other, and some are not. The world is full of people, animals, buildings, foods, tools, methods of transportation and other categories of things. We can organize the world around us by recognizing that objects have similarities and differences, and then put them into groups based on what makes them alike and different. This helps us stay organized and make sense of the world around us.

Let’s start by thinking about a category, or class, of objects that are similar, but not completely alike. They share some of the same characteristics, but they aren’t the same exact thing. Can you think of different kinds of foods that belong in the Vegetable class?”

Think, Pair, Share

Give students time to brainstorm different vegetables in pairs, and record answers for the whole group to see. Prompt students to describe characteristics or features of the vegetable they name; particularly shared properties that include them in the Vegetable class (seeds, skin, etc). Once you have brainstormed vegetables and recorded a list, ask students to think about what makes the vegetables different from each other (shape, texture, how they grow, color, etc.).

“Programmers use something called Classes to create objects that are similar to each other in their programs. Classes define what an object in a program will look like- what color it will be, how big it will be, its shape, and so forth.

Classes are like a blueprint, or a template, that gives the program information about an object. New objects can easily be created from classes without programmers having to manually write the code for objects that may be the exact same or very similar. Classes can simplify a really complex object. Without classes, we couldn’t have games! We need classes in our code to define what our objects look like and what they do in our programs.”

Guided Practice

Students will follow instructions to experience classifying objects in a hands-on way. Students will analyze and reflect on how the similarity of objects in the real world mirror Object-Oriented Programming. 

Curriculum Connection

CSTA Computational Thinking CT.L2-11: Analyze the degree to which a computer model accurately represents the real world.

 Activity Materials

  1. Floor Space
  2. Tape for 5 lines on the floor a few feet apart (do this before the activity!)
  3. Activity Images: Red ball, Baseball, Soccer ball, Basketball, Football

Activity

Explain that we are going to do an activity that will help us identify similarities and differences between objects and put them into groups accordingly. Explain that the activity involves movement and listening to directions, and go over your classroom rules and procedures for this. 

Hand out (at random) the images to students. Each student should have one picture, and they should not show, trade, or share with anyone! Print as many of each as you will need, depending on how many students you have.  

Once each student has their own image, have the class stand in a horizontal line on a START line, facing the other, numbered lines on the floor. Prepare students to listen for the first instruction (given in a conditional statement!) and then follow accordingly to classify.

  1. T (say): “If the image you are holding is a ball, then move forward to the first line.” (Everyone moves.)
  1. T(say): “If your picture is a round ball or a circle, then move to the second line.”

 (Everyone moves except students with a football.) 

  1. T(say): “If your picture is a ball with lines on it, then move to the third line.”

 (Everyone moves except students with a red ball.)

  1. T(say): “If your picture is a ball that you are supposed to use your hands with, then move to the fourth line.”

 (Everyone moves except students with a soccer ball.) 

  1. T(say): “If your picture is a ball that bounces, then move to the fifth line.”

 (Everyone moves except students with a baseball.) 

At the end of the activity, students on line 1 should have a football, students on line 2 should have a red ball, students on line 3 should have a soccer ball, students on line 4 should have a baseball, and students on line five should have a basketball. 

T (ask): “What do you notice about the people standing on the same line as you? What do students on the line behind you have for a picture? What do students on the line in front of you have for a picture?” 

Call students to come together to return their images and engage in a closing discussion.

Independent Practice

Students independently practice the concept on their devices in Bug World Instance Station, "Time for Slime" 8.1 and 8.2.

Closing Discussion 

  1. What did you notice after the first direction was given?
    (Everyone had one thing in common, everyone had a ball, everyone moved)

  2. What happened each time a new direction was given?
    (We started to find differences, not everyone moved, people became spread out)

  3. How were some of the pictures alike and different from each other?
    (All balls, all used to play, different uses, materials, different colors, different sizes, different patterns, different shapes)

  4. How did we sort, or classify, in this activity?
    (Observed similarities and differences)

  5. We can sort and group almost anything in the world around us. What is an example of something you could classify in this room?
    (books, writing utensils, art supplies, personal belongings, students in the class, etc.)

  6. What class do you think all of these objects belong to? (ball, sports, equipment, etc.)

enter your email address and we'll deliver it to you right away!