Lesson 29: Functions with Parameters in Artist

Overview

In this lesson, students continue working with functions with and without parameters. Students will get the chance to create their own drawings before modifying functions in a freeplay level.

Purpose

This lesson is providing students with a space to create something that they are proud of.

These puzzles allow students to create complex images by building off of previous, more simple projects. At the end of this lesson, students will have images to be proud of.

Objectives

Students will be able to:

• Practice abstraction with the use of parameters.
• Recognize when a function could help to simplify a program.

Preparation

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

Vocabulary

• Function - A named group of programming instructions. Functions are reusable abstractions that reduce the complexity of writing and maintaining programs.
• Parameter - An extra piece of information passed to a function to customize it for a specific need

Teaching Guide

Warm Up (10 min)

Introduction

Ask the class if they recall using parameters in "Functions Unplugged: Songwriting with Parameters".

• What does it mean to "use a parameter" with functions?
• Using a parameter means the function takes in a variable value that can specialize the function. In "Songwriting with Parameters" this means we can change the repeated lyrics to be a little different everytime.
• Why would we use a parameter with a function?
• We use parameters with functions so that we don't have to write multiple functions that are very similar. If we wanted to draw three squares with three different side lengths, we would only have to write one function with a parameter versus three different functions without parameters.
• Why don't we always use parameters with functions?
• We don't ALWAYS need a customizable function. Sometimes functions are just a handy way to reuse identical code in multiple places.

Tell the class that they will be making some awesome drawings in Artist using functions with parameters!

Main Activity (30 min)

CSF Express Course - Website

Ask the students to close their eyes and raise a hand. If they are feeling really good about using parameters, have all fingers open (like a high five). If they don't feel very good about using parameters, have them raise a fist. If they are feeling somewhere in between, have them raise one, two, three, or four fingers on their hand.

With that, determine if your class will need more practice with functions before moving on to the online puzzles. If only a small portion of your class isn't feeling great about using parameters, make sure to implement pair programming in this lesson.

Wrap Up (15 min)

Journaling

Having students write about what they learned, why itâ€™s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.

Journal Prompts:

• What was today's lesson about?
• How do you feel about today's lesson?
• Sketch out a drawing you made today. Can you write the code needed to create this?
• Draw a picture you would like to create with code. Try writing or drafting the code that would make that drawing.

Standards Alignment

CSTA K-12 Computer Science Standards

AP - Algorithms & Programming
• 1B-AP-08 - Compare and refine multiple algorithms for the same task and determine which is the most appropriate.
• 1B-AP-09 - Create programs that use variables to store and modify data.
• 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.