Parameters, Return, and Libraries - Lesson 8: Project - Make a Library Part 1

Overview

In this lesson students begin a multi-day project designing a library of functions. Students will brainstorm common problems they've encountered while programming this year and begin to design functions that address those common problems.

Goals

Students will be able to:

  • Select a theme for a library of functions
  • Design the API for a library of functions, including the function names, purpose, and parameters, and types of values each function will return

Purpose

This project caps off everything students have learned about programming as they head into the Create PT. Students are "building blocks" that classmates will have access to in order to create projects of their own. This kind of thinking requires not only a mastery of programming concepts and skills, but the ability to think more abstractly about how programs are built. Students need to identify common situations or problems that they and other programmers may encounter, and help build commands to address that problem.

This project also caps off a unit that is all about abstraction. On one level students are thinking about procedural abstraction, and simply learning how to design functions. On another level, however, they're learning to think abstractly. They're not merely designing a function, but they're thinking about the entire process of how programs are developed and common problems or situations that arise. This mental approach to thinking about why to build a function is just as important as knowing the steps to design one.

Resources

Supplemental Code.org material

Getting Started (5 minutes)

Prompt: Think back over all the different apps you've built this year. What blocks do you wish already came with App Lab to help you build those apps?

Discuss: Have students brainstorm either individually or with a partner. Then have a few volunteers share their ideas with the class.

Discussion Goal

Goal: This prompt foreshadows the project students will complete in which they'll be building a library of functions. Sharing this library will allow them to actually add new blocks to App Lab for themselves or their classmates.

Remarks

  • Today we're going to begin our final project before the Create PT. You'll be building a library of functions that you and others will be able to import and use.

Activity (40 minutes)

Teaching Tip

Differentiation: The size of library is a good way to differentiate in this project. Students who are more comfortable programmers should be encouraged to develop larger libraries of functions.

Difficulty of Suggested Functions: The functions suggested in the project guide are loosely in difficulty order. Functions that appear near the bottom of that list are actually quite difficult and will require students to build substantially upon things they've learned in the course.

Group: Students may complete this project individually or in pairs.

Distribute: Give students each a copy of the Project Guide - Make a Library - Project Guide

Project Description - 5 mins: As a class review the project description, what they'll submit, and the steps. Make sure students are also aware that they have access to the rubric.

Step 1 - Brainstorm - 5 Mins: Give students 5 minutes to brainstorm a theme for their library. Many specific ideas are given to students for the types of functions they could write, but ideally students will develop functions that are focused on a specific context they find interesting.

Step 2 - Design - 10 mins: Before students start writing the code for their project they should stend 10 minutes defining the way the different functions in their library should work. This means they'll need to write out the comments that describe the function, the different parameters, and what will be returned.

Step 3 - Build - 20 mins: Give students the remainder of time in class to work on building out their library.

  • Students should start by working on one of their functions that includes all four features. Students will need to develop a function like this as part of the Create PT and also will be answering questions about their function in the free response questions at the end of the project.
  • Circulate the room offering support to students. If they have successfully completed step 2 of their project guides then they should be able to write a lot of code very quickly to set up their functions and comments.

Wrap Up (0 minutes)

Remarks

  • Great work today. Next time we meet you'll have more time to work on your libraries and then you'll need to share them with another group for feedback.

Standards Alignment

  • CSTA K-12 Computer Science Standards (2017): 2-AP-14, 3A-AP-18, 3B-AP-14, 3B-AP-16
  • CSP2021: CRD-2.H.1, CRD-2.H.2

Next Tutorial

In the next tutorial, we will discuss Code.Org Unit 7 Lesson 9, which describes Learn about parameters and return.