< Unit 3 - Interactive Animations and Games ('21-'22)

Lesson 4: Shapes and Parameters

45 minutes

Overview

Question of the Day: How can we use parameters to give the computer more specific instructions?

In this lesson students continue to develop their familiarity with Game Lab by manipulating the width and height of the shapes they use to draw. The lesson kicks off with a discussion that connects expanded block functionality (e.g. different sized shapes) with the need for more block inputs, or "parameters". Students learn to draw with versions of ellipse() and rect() that include width and height parameters. They also learn to use the background() block.

Purpose

This lesson gives students a chance to slightly expand their drawing skills while continuing to develop general purpose programming skills. They will need to reason about the x-y coordinate plane, consider the order of their code, and slightly increase their programs' complexity. This lesson should be focused primarily on skill-building.

Assessment Opportunities

  1. Use and reason about drawing commands with multiple parameters

    See level 7 in Code Studio.

CSTA K-12 Computer Science Standards (2017)
    • 2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
    • 2-AP-17 - Systematically test and refine programs using a range of test cases.
    • 2-AP-19 - Document programs in order to make them easier to follow, test, and debug.

Agenda

Objectives

Students will be able to:
  • Use and reason about drawing commands with multiple parameters

Preparation

  • Review the level sequence in Code Studio

Links

Heads Up! Please make a copy of any documents you plan to share with students.

Vocabulary

  • Parameter - Additional information provided as input to a block to customize it's functionality

Teaching Guide

Lesson Modifications

Attention, teachers! If you are teaching virtually or in a socially-distanced classroom, please click here to access modifications that can be used during this lesson.

Warm Up (5 minutes)

Shapes of Different Sizes

Prompt: The rect block has two inputs that control where it's drawn - the x and y position. If you wanted these commands to draw different sizes of rectangles, what additional inputs would you need to give these blocks?

Discuss: Students should brainstorm ideas silently, then share with a neighbor, then share out with the whole class. Record ideas as students share them on the board.

Discussion Goal

Goal: This discussion introduces the vocabulary word "parameter" and also helps students understand the need for parameters. Students will be seeing versions of the ellipse() and rect() block in this lesson that have additional parameters. Students may say they want inputs for the size of the shapes, their color, etc. During this conversation tie the behaviors the students want to the inputs the block would need. For example, if you want rectangles to be a different size, the block will need an input that lets the programmer decide how large to make it.

Remarks

If we want our blocks to draw shapes in different ways they'll need more inputs that let us tell them how to draw. The inputs or openings in our blocks have a formal name, Parameters, and today we're going to be learning more about how to use them.

Key Vocabulary: Parameter - Additional information provided as input to a block to customize it's functionality

Question of the Day: How can we use parameters to give the computer more specific instructions?

Activity (35 minutes)

Programming with Parameters

Group: Put students into pairs for the programming activity.

Transition: Move students onto Code Studio.

Assessment Opportunity

You can use this level as a formative assessment for students. Click inside the level to view a rubric and leave feedback to your students

Teaching Tip

Level 8e: This creative task allows students to use their new knowledge to achieve a goal that they set for themselves, or to tinker with the code without a specific set goal.

Wrap Up (5 minutes)

Journal

Question of the Day: How can we use parameters to give the computer more specific instructions?

Prompt: You use parameters to control your shape's location and size. Can you think of any other situations in which parameters might be useful?

Share: Allow students to share our their ideas.

Discussion Goal

Student answers will vary, but they should all follow the pattern of giving more specific information for how to carry out a task. If students have trouble thinking of something, you may want to give some examples for things a computer could do, such as ring an alarm (with a parameter for a certain time) or play a song (with a parameter for the song title).

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.