Lesson 23: 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.

Agenda

Warm Up (10 min)

Main Activity (30 min)

Wrap Up (15 min)

View on Code Studio

Objectives

Students will be able to:

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

Preparation

Links

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

For the Teachers

For the Students

Vocabulary

  • Function - A piece of code that you can easily call over and over again.
  • Parameter - An extra piece of information passed to a function to customize it for a specific need

Support

Report a Bug

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)

Course F Online Puzzles - 2018 - 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

View full course alignment

CSTA K-12 Computer Science Standards (2017)

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.

Cross-curricular Opportunities

This list represents opportunities in this lesson to support standards in other content areas.

Common Core English Language Arts Standards

L - Language
  • 5.L.6 - Acquire and use accurately grade-appropriate general academic and domain-specific words and phrases, including those that signal contrast, addition, and other logical relationships (e.g., however, although, nevertheless, similarly, moreover, in addition).
SL - Speaking & Listening
  • 5.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 5 topics and texts, building on others’ ideas and expressing their own clearly.
  • 5.SL.1.a - Come to discussions prepared, having read or studied required material; explicitly draw on that preparation and other information known about the topic to explore ideas under discussion.
  • 5.SL.4 - Report on a topic or text or present an opinion, sequencing ideas logically and using appropriate facts and relevant, descriptive details to support main ideas or themes; speak clearly at an understandable pace.
  • 5.SL.6 - Adapt speech to a variety of contexts and tasks, using formal English when appropriate to task and situation.

Common Core Math Standards

G - Geometry
  • 5.G.2 - Represent real world and mathematical problems by graphing points in the first quadrant of the coordinate plane, and interpret coordinate values of points in the context of the situation.
MP - Math Practices
  • MP.1 - Make sense of problems and persevere in solving them
  • MP.2 - Reason abstractly and quantitatively
  • MP.3 - Construct viable arguments and critique the reasoning of others
  • MP.4 - Model with mathematics
  • MP.6 - Attend to precision
  • MP.7 - Look for and make use of structure
  • MP.8 - Look for and express regularity in repeated reasoning
NBT - Number And Operations In Base Ten
  • 5.NBT.5 - Fluently multiply multi-digit whole numbers using the standard algorithm.

Next Generation Science Standards

ETS - Engineering in the Sciences
ETS1 - Engineering Design
  • 3-5-ETS1-1 - Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.