Unit7

Unit 7 - Parameters, Return, and Libraries

Unit Overview

Students learn how to design clean and reusable code that can be shared with a single classmate or the entire world. In the beginning of the unit, students are introduced to the concepts of parameters and return, which allow for students to design functions that implement an algorithm. In the second half of the unit, students learn how to design libraries of functions that can be packaged up and shared with others. The unit concludes with students designing their own small library of functions that can be used by a classmate.

Teaching Tip

Modifications for Virtual and Socially-Distanced Classrooms

Are you teaching in a virtual setting or in a socially-distanced classroom? Check out this document for ideas and resources to help you tailor common practices like Think Pair Share or Peer Feedback to your learning environment.

For lesson-specific modifications, check out the Lesson Modifications section within Lesson Plans.

Learn more about how to use these resources here.

Unit Philosophy and Pedagogy

  • Learning by Building Libraries: In the second EIPM sequence of this unit, students learn to use the Student-Create Libraries tool in App Lab. This tool allows them to build and share libraries of functions that can be used in many different projects . This tool serves many purposes besides simply teaching students about libraries. By having to write functions that other students find useful, they'll need to think about common patterns or situations that they've seen in projects across the course. Students will also practice commenting their code so others can understand how it works, practice designing functions that use parameters and return.

  • Final Preparation for the Create PT: Students learn very few new concepts in this unit; nevertheless, it can be challenging because students need to learn how to integrate the ideas of parameters and return with every other concept they've learned in this course so far. This unit presents a good opportunity to do a final review of every programming construct covered in the course as students prepare to demonstrate what they've learned on the Create PT.

Major Assessment and Projects

The unit project asks students to design a library of functions that they can share with classmates. Their library must contain at least two functions and at least one of those functions must include a parameter, return, a loop, and an if-statement. This requirement ensures students practice skills they'll use in the Create PT. Using a project guide, students choose a theme for their library, build it, test it, and exchange feedback with other students. Students submit their library code, project guide, and written responses to reflection questions about how the app is designed and the development process they used to make it. They will also complete an end-of-unit assessment aligned with CS Principles framework objectives covered in this unit.

AP Connections

This unit and unit project helps build towards the enduring understandings listed below. For a detailed mapping of units to Learning Objectives and EKs please see the "Standards" page for this unit.

  • CRD-2: Developers create and innovate using an iterative design process that is user-focused, that incorporates implementation/feedback cycles, and that leaves ample room for experimentation and risk-taking.
  • AAP-2: The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values.
  • AAP-3: Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence.

This unit includes content from the following topics from the AP CS Principles Framework. For more detailed information on topic coverage in the course review Code.org CSP Topic Coverage.

  • 3.12 Calling Procedures
  • 3.13 Developing Procedures
  • 3.14 Libraries

The College Board has supplied formative Create PT questions to help prepare students to complete the Create Task. We recommend that students complete the following prompts with the unit project. More information can be found in Code.org CS Principles Topic Coverage.

  • 3.c.i
  • 3.c.ii
  • 3.c.iii
  • 3.c.iv
  • 3.d.i
  • 3.d.ii
  • 3.d.iii

Week 1

Lesson 1: Parameters and Return Explore

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (30 mins)
  • Wrap Up (10 mins)

Develop a mental model for how functions can be generalized using parameters and return values.

Teacher Links: Presentation Students Links:

Lesson 2: Parameters and Return Investigate

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Investigate and modify sample apps that use parameters and return values.

Teacher Links: Presentation

Lesson 3: Parameters and Return Practice

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Practice programming with parameters and return values through a set of programming puzzles.

Teacher Links: Presentation

Lesson 4: Parameters and Return Make

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Make an app that uses functions with parameters and return.

Teacher Links: Presentation Students Links: Activity Guide

Lesson 5: Libraries Explore

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (10 mins)

Develop a mental model for how libraries work.

Teacher Links: Presentation

Week 2

Lesson 6: Libraries Investigate

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Investigate and modify sample apps that use libraries learn how libraries help programmers simplify and reuse their code.

Teacher Links: Presentation

Lesson 7: Libraries Practice

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Practice programming with libraries through a set of programming puzzles.

Teacher Links: Presentation

Lesson 8: Project - Make a Library Part 1

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (40 mins)
  • Wrap Up (0 mins)

The first day of a three day project where students build and test their own libraries.

Teacher Links: Presentation Students Links: Project Guide

Lesson 9: Project - Make a Library Part 2

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (40 mins)
  • Wrap Up (0 mins)

The second day of a three day project where students build and test their own libraries.

Teacher Links: Presentation Students Links: Project Guide

Lesson 10: Project - Make a Library Part 3

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (40 mins)
  • Wrap Up (3 mins)

The third day of a three day project where students build and test their own libraries.

Teacher Links: Presentation Students Links: Project Guide

Week 3

Lesson 11: Assessment Day

  • Lesson Modifications
  • Assessment (25 mins) (5 mins)
  • Assessment Review (20 mins) (35 mins)

Students complete a multiple choice assessment which covers the unit topics.