Lesson 17: Functions with Harvester
55 minutes
Overview
In this skill-building lesson, students will use conditionals with functions to harvest crops in Harvester.
Purpose
This lesson is meant to further push students to use conditionals with functions. These puzzles are intended to increase problem solving and critical thinking skills.
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-10 - Create programs that include sequences, events, loops, and conditionals.
- 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
- 1B-AP-17 - Describe choices made during program development using code comments, presentations, and demonstrations.
Agenda
Objectives
Students will be able to:
- Recognize when a function could help to simplify a program.
- Use pre-determined functions to complete commonly repeated tasks.
Preparation
- Play through the puzzles to find any potential problem areas for your class.
- Make sure every student has a reflection journal.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the teachers
- CSF - Course E - Slides - Slides (Download)
Vocabulary
- Conditionals - Statements that only run under certain conditions.
- Function - A piece of code that you can call over and over again.
Teaching Guide
Warm Up (10 minutes)
Introduction
Display: Show "Reflect" slide
Reflect:
- When would you use a function?
- Do you think functions make programming easier or harder? Why?
At this point, your students should already be introduced to functions. Take this time to have them discuss the advantages and disadvantages of using functions in a program. Either have them pair-share or discuss as a class. Try using examples of hard or easy puzzles in either Artist or Bee.
Vocabulary
Display: Show "Vocabulary" slide
- Conditionals - Statements that only run under certain conditions.
- Function - A piece of code that you can call over and over again.
Main Activity (30 minutes)
Online Puzzles
Some puzzles will have a function pre-declared for the students to fill in. It may be helpful for the students to write the entire program without a function first, then determine where a function would be useful in the program.
It's important to make sure that every student is completing each puzzle with a dark green dot. If some of your students are struggling to simplify code and use functions, set up teams of expert students within your class to go around and answer questions.
Don't forget to provide pencils and paper to help students sketch out possible solutions.
Display: Show "The Harvester" video
Display: Show “Level 2-12 - Skill Building” slide
Display: Show “Level 13 - Prediction” slide
Wrap Up (15 minutes)
Reflection
Display: Show “Reflect” slide
Reflect How does a function help to simplify your program?
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.