GET NEW FUZZES to support Computer Science! Donate $1 Learn More

Advanced

Fifth Grade


Programming concept covered:

Object-Oriented Programming: Properties, Classes, and Variables35

Time: 45-50 minutes

Lesson Materials

  1. Character trait JavaScript template
  2. Current independent reading book or book of choice for the activity
Download Teaching Materials

Print Lesson Plan

Get a free teacher account

Objectives


  1. Students will be able to identify properties as variables attached to an object.
  2. Students will be able to identify physical character traits of a character in a novel and relate them to properties of an object in JavaScript code.
  3. Students will be able to modify properties of an object in JavaScript to make the object different.

Vocabulary


  • Properties: The features that describe an object. In the Dog class, a property would be the color of the dog.

  • Object: An object is a living ‘creation’ of a class. Whereas a class is just a blueprint, the object actually exists, can display attributes, and perform actions. Your pet dog is an example of this: your dog is of the Dog class: your dog was born, barks, and has a tail, like all dogs.

  • Variable: A variable is a placeholder for information (data). The name of the variable refers to the value being stored there. For example, “color” is a variable and the value could be “red”.

  • Value: A value is data that is being stored in a variable. If the variable is “color,” the value could be “red”, “blue”, “green”, etc. depending on the class or object. If the variable was “speed,” the value could be a number, such as “5”.

  • Inheritance: In the real world, there are certain objects that are similar, but not the same. For these objects, you wouldn’t want to develop completely separate definitions for these similar objects, but rather have a way to reference them as being similar but different. The way that this is handled in programming is a concept called ‘inheritance’.
    For example, a German Shepherd and a Golden Retriever are both dogs, but each has certain distinguishing characteristics and properties that the other does not. A German Shepherd might have a coat color of brown and black, while Golden Retrievers have a blonde coat. A German Shepherd also has pointy ears, while Golden Retrievers have flappy ears.

Direct Instruction (I do)


Lesson Tip

If you haven't taught variables, teach a mini-lesson before diving into properties. Go over what a variable is, what a value is, and give examples. Explain that variables can be changed or modified, allowing objects to be different from each other. Example: You can change a person's hair color (variable) from brown to red by editing the value (the color).

To help you and your students understand variables, check out our resources here:
http://support.kodable.com/teaching-with-kodable/programming-101-about-the-concepts/what-are-string-variables

Review:
Variables and values. Go over the definitions of these, and ask students to recall their work with variables (types of variables, examples from Asteroidia, what they know or wonder about variables). 

Introduce:

T(say): “A property is a variable that is attached to an object. This is important because properties allow objects to be different from each other and the main class they are created from.  Without variables, we could not have properties.  Today, we are going to learn about properties in JavaScript by connecting them to something we already know about- characters in the books we read!”

T (Explain): Characters in programs (video games, computer games) are characters like we read about in books. If we wanted to put a character from a book we are reading into a game, we could! We would first need to write the code to tell the computer about our character. We would need to define the class, create the individual object, and modify properties of the object so it looked exactly like our character on the screen.

Think, Pair, Share

Think of a character from either a video game, app, or computer program. What do they look like? How would you describe them?

Explain that characters are written into programs, just as an author writes characters into a book. The author of a book thinks about who they want their character to be: what they look like and what they do.

Think, Pair, Share

Think of your all time favorite character from a book you read or are currently reading. How would you describe them? What do they look like on the outside?

Show students the character trait graphic organizer that they will be using for the activity. As an example, go over the handout and explain that this character could be written into a program but we would need to give the computer the information so it would know what the character will look like. Show the example and highlight the JavaScript. 

“Today, we are going to use characters we know from our books and think about their physical character traits on the outside. Some characters are humans or belong to the People class. Some characters are not, like in fictional stories about robots, dinosaurs, etc. Think about what class your character belongs to, and recall that our characters are individual objects created from a class.”

Think, Pair, Share

Who is your character? What class do they belong to? What properties does your character have (what does your character look like- hair color, eye color, features of the character)?

Once students have brainstormed the character they will use for the activity, hand out the graphic organizer and have students complete it.

Guided Practice 

Students will select a character from a current or recent book that will be used to identify physical, or outer, character traits. Students will fill out the graphic organizer, and modify the properties in the JavaScript to match their character. 

Activity Materials

  1. Character trait JavaScript template
  2. Current book or book chosen for the activity

Activity Procedure

  1. Go over the example whole group.
  2. Hand out the graphic organizer and have students select the book they are using.
  3. Students fill out physical character traits of the chosen character from the book they selected.
  4. Students complete the JavaScript portion of the activity by filling in the properties that their character has. Note: Students may need to edit the name of the class if their character is something other than a human!
  5. Collect student work or have students safely hold onto it- the activity will be built upon in the next lesson!

Independent Practice

Students complete lessons in Bug World Property Point, "PROPin' Fresh" 9.1 and 9.2

Exit Ticket: Simile Me

 Have students complete the following sentence: "A property is like ___ because___."

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