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.

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.

Objectives

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

Preparation

• Ensure students have access to their project guides from last class.

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

Forum

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 (2 mins)

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 mins)

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?

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

• Tests Refresher: Briefly review with students how to use `console.log` 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 (0 mins)

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)

AP - Algorithms & Programming
• 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
• 3A-AP-18 - Create artifacts by using procedures within a program, combinations of data and procedures, or independent but interrelated programs.
• 3B-AP-14 - Construct solutions to problems using student-created components, such as procedures, modules and/or objects.
• 3B-AP-16 - Demonstrate code reuse by creating programming solutions using libraries and APIs.