Lesson 4: Parameters and Return Make

App Lab

Overview

Students use the knowledge and skills they've developed working with parameters and return values to develop a Rock Paper Scissors App. Unlike typical Make projects, students are given a significant portion of the starter code but are given three functions with parameters and return values that they'll need to develop themselves. At the end students submit their apps which can be assessed using a provided rubric.

Purpose

Make lessons typically ask students to take on an entirely blank screen when writing their program. In this instance students have to take on the "blank function" which needs to fit within the larger program they're developing. This is part of a broader mindset shift that students develop in this unit. Functions with parameters and return values operate like their own "mini programs" which can be written and tested independently. There is actually less difference than students might think between previous make projects, in which students get the user interface elements and no code, and this project, in which they get some starter code but blank functions with parameters. In each case they need to develop programs that integrate into a larger portion of the project. The focus of this unit is how functions with parameters and return values help further split programs into logical chunks like this.

Agenda

Lesson Modifications

Warm Up (5 mins)

Activity (35 mins)

Wrap Up (5 mins)

View on Code Studio

Objectives

Students will be able to:

  • Write functions with parameters and return values that meet a set of specified requirements
  • Debug programs that use functions with parameters and return

Preparation

  • Review the app students will need to make and ideally spend some time working on the project yourself to anticipate the challenges students will encounter

Links

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

For the Teachers

For the Students

Teaching Guide

Lesson Modifications

Attention, teachers! If you are teaching virtually or in a socially-distanced classroom, please read the full lesson plan below, then click here to access the modifications.

Warm Up (5 mins)

Discussion Goal

Goal: This discussion should prompt students to better understand what turns out to be a slightly different make project. Today they're going to be taking on "blank functions" rather than "blank screens". This is because with parameters and return values you can chunk out your programs into pieces that have well-defined behavior. Remind students that this is known as procedural abstraction. If students don't land on these ideas don't aim to force it but return to this idea in the wrap up.

Prompt: How do parameters and return change the way you write programs?

Discuss: Have students share their ideas with a partner and then discuss as a class.

Remarks

Today we're going to be working on another Make project, but this one is a little bit different than others we've done in the course. A lot of the code will already be written for us, and we'll be working on blank functions, rather than entirely blank programs. Thanks to the way that parameters and return work, it's easy to design programs this way.

Activity (35 mins)

Build the Rock Paper Scissors App

Group: Make a determination as to whether this project will be completed in pairs or individually. You may even choose to let students decide.

Level 2 - Explore: Have students explore the working Rock Paper Scissors app in Level 2. If students are not working in pairs they should still discuss the prompts with a neighbor.

  • What does each button do
  • How does the screen get updated after clicking each button

Review: Quickly review what students will be doing again before they move on to the next step.

Teaching Tip

Supporting Students: While students are working on their apps, circulate the room and check in with students who need a little help. Encourage students to collaborate and discuss bugs with each other.

Debugging: Review with students steps they can use to debug if they get stuck:

  • Build small parts of the program at a time and test them to make sure they work
  • Run the code on turtle mode
  • Add the variables to the watcher
  • Explain the code to a friend and clarify the differences between what they expect to happen and what is actually happening in

Distribute: Give students copies of CSP Parameters and Return Make - Rock Paper Scissors App - Activity Guide if you will be using it during the class.

Do This: Direct students to level three where they complete the Rock Paper Scissors App. Based on the needs of your classroom decide whether you will collectively go through the activity guide or have students complete it individually. Afterwards give them time to work on their projects and circulate the room to offer support. Students who finish early can work on the extensions suggested in the activity guide.

Submit: Encourage students to check the rubric on the last page of the Activity Guide before submitting.

Wrap Up (5 mins)

Discussion Goal

Goal: This prompt should help review ideas that students saw in this project, in particuarly that parameters and return help break programs into chunks. It should also help them see that this approach could be used to collaboratively design programs. If teammates agree in advance what each function should do they can go off and write them separately before coming back together to make the entire app work.

Prompt: How could using parameters and return help you write programs collaboratively?

Remarks

Parameters and return help us chunk programs into pieces. Each important piece can be made into its own function which can be written and tested separately from the others. If you and your partner agree in advance how to split up the way a program is written and are clear on what each function needs to do, you could develop a program just like this make project.


Assessment: Grading the Project

Rubric: Use the rubric provided with the project to assess student projects.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.

CSP2021

CRD-2 - Developers create and innovate using an iterative design process
CRD-2.F - Design a program and its user interface.
  • CRD-2.F.7 - The design phase of a program may include: ●        brainstorming ●        planning and storyboarding ●        organizing the program into modules and functional components ●        creation of diagrams that represent the layouts of the user interface ●