Lesson 17: Functions in Bee

Function | Bee

Overview

In the second round of practice with online functions, students will navigate complex paths, collect plenty of nectar, and make lots of honey.

Purpose

Students will discover the versatility of programming by practicing functions in different environments. Here, students will recognize patterns in the bee's maze. The bee will need to navigate the play area, collect nectar, and make honey. Students will learn to organize their programs and create functions for repeated code.

Agenda

Warm Up (10 min)

Main Activity (30 min)

Wrap Up (15 min)

Objectives

Students will be able to:

  • Use functions to simplify complex programs.
  • Use pre-determined functions to complete commonly repeated tasks.

Preparation

Links

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

For the Teacher

Vocabulary

  • Function - A named group of programming instructions. Functions are reusable abstractions that reduce the complexity of writing and maintaining programs.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Introduction

Ask the students if they enjoyed creating images in Artist during the last lesson. Open up a class discussion on the puzzles they encountered (both hard and easy).

Tell the class that they will now be using functions to simplify code with a bee. The bee needs to traverse a maze, collect nectar, and make honey. Functions will make their program cleaner by compartmentalizing complex chunks of code.

This might be a good time to discuss the differences between using functions and using loops.

  • Use loops when you need to do something several times in a row, exactly the same way
  • Use a function when you need to do something at different times in the same program

Main Activity (30 min)

Course E Online Puzzles - Website

Similar to the last lesson, students may benefit from programming without functions then creating functions from repeated code. We recommend providing paper and pencils for students to write (or draw) out their ideas. Also, if students are having trouble recognizing patterns, have them work with a partner on the harder puzzles.

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.

  • What was today's lesson about?
  • How do you feel about today's lesson?
  • What did your functions do in the programs you wrote today? How did that help you?
  • When should you use a function instead of a loop?

Standards Alignment

View full course 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-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.