Parameters, Return, and Libraries - Lesson 9: Project - Make a Library Part 2

Overview

Students continue to develop their library of functions. Students are encouraged to begin developing tests for their functions to make sure they return values as expected. Late in the lesson students exchange their library with a classmate for feedback.

Goals

Students will be able to:

  • Write tests for functions with a library that they designed
  • Provide feedback to their classmate about a library they designed

Purpose

In this lesson students continue to write the code for their libraries, but a big focus is on making sure it works as expected. Through writing tests of their own students practice thinking through how different inputs into a function lead to expected outputs. Sharing their libraries with classmates helps check not only that their code works as expected, but that their library is clear, approachable, and useful, to someone else.

Resources

Supplemental Code.org material

Getting Started (2 minutes)

Remarks

  • Today you are going to have more time to work on your library, but you're going to focus on testing it in two very different ways. In the first half of the lesson you'll still have work time to write your library, but you should develop tests like we practiced in this unit to make sure they're working as you expect.
  • In the second half of the lesson you'll share your library with a classmate who will try using it themselves and will give feedback. Next time we meety you'll be able to use this feedback and testing to make the final edits to your library.
  • Let's get to it!

Activity (40 minutes)

Step 4 - Test - 20 mins: In this section students briefly review how to write tests for functions and then actually go write them.

Teaching Tip

Writing Tests: Remind students of these important strategies while testing their program code.

  • They should actually call their functions with different inputs
  • They should try out values that try out different ways their functions work, or right below, at, and after the cut offs of the conditional statements within their functions

Supporting the Feedback Process: There are a few logistical steps involved in getting students to provide feedback to one another. They'll need to exchange project guides, navigate to a different level from the one they're working in, and import a classmate's library. Once this is done make sure you encourage good processes in testing one another's libraries by asking questions

  • Can you tell what the library is supposed to do?
  • Do all the functions work as they're supposed to? How do you know?
  • What are ways the library could be improved?
  • Tests Refresher: Briefly review with students how to use output to write tests for their functions.
  • Test: Give students time to write tests for their functions and then continue to program to fix any errors they encounter.

Group: Have students find a classmate with whom to share their library and give feedback. Students should trade project guides with their classmate.

Step 5 - Feedback - 20 mins: Students will need to go through a series of steps to share their libraries and given feedback

  • Export Your Library: Walk students through the steps necessary to export their own library
  • Import a Library: Walk students through the steps necessary to import a library from their classmate.
  • Give Feedback: Walk students through ways that they can use a classmate's library to test it out. Make sure they give feedback on their classmate's project guide under Step 5.

Step 6 - Improve: Students should return project guides to their classmates and review the feedback. Next class they'll have time to improve their libraries and prepare to submit them.

Wrap Up (3 minutes)

Remarks

  • Great work today. At this point you should have a good sense of how your library is working and what edits you'll need to make. Tomorrow you'll finish your library and answer some questions about them.

Standards Alignment

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

Next Tutorial

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