Lesson 2: Lists Investigate

Overview

In this lesson students work with partners to investigate three different apps that use lists. Students first explore all three apps without seeing the code to notice similarities and predict how they will work. Then they explore the code itself and make additions and modifications to the apps. To conclude the lesson, students review and discuss common programming patterns with conditionals.

Purpose

After building a conceptual model for list and list operations in the previous lesson, this lesson allows students to see how they are actually implemented in code. This lesson also introduces common programming patterns when using lists. Students will have some opportunities to modify working code in this lesson, but the most significant practice with lists will come in the following lesson.

Agenda

Lesson Modifications

Warm Up (5 mins)

Activity (35 mins)

Wrap Up (5 mins)

View on Code Studio

Objectives

Students will be able to:

  • Identify common programming patterns using lists
  • Explain the purpose of programming patterns with lists both in terms of how they work and what they accomplish
  • Modify apps that make use of common programming patterns with lists to adjust their functionality

Preparation

  • Review the three apps that students will be investigating and the questions about them. Note that there are target responses to each of these questions on the levels.

Links

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

For the Teachers

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

Discussion Goal: Students may bring up the following points:

  • Both are used to store information
  • Lists store multiple items, but variables only store one
  • When written in Javascript, both start with the keyword var
  • Lists are written with square brackets around them
  • Lists can store many different types of data

Managing complexity:

  • You don't need to know how a list is created in order to use it - all you need is the name. There is a separation between the abstract properties of the data type (list) and the concrete details of its representation.
  • Programs that use lists are easier to read and manage - separate variables are not needed for each individual element

Prompt: What are some similarities and differences between variables and lists? How does a list manage complexity in a program?

Activity (35 mins)

Teaching Tip

Finding Target Responses: With a verified teacher account you should be able to see target responses to each question posed on each level.

Prepping for Investigate Lessons: The best way to prepare for this lesson is to go through the experience yourself. Check out the three apps in Code Studio to get a sense for how they work. Then watch the videos. Then move on to the Code Investigation and actually try to answer all the questions for each app. To help you out, however, answers are provided on the bottom of the instructions area for verified teachers.

Show Videos at the Front: Show videos at the front of the room rather than having students watch them individually. It will be a good opportunity to bring the room back together.

Display Code at the Front: If your room allows it, display the code during the Code Investigation at the front of the room. When students mentions specific lines of code actually scroll to that line and read through it together.

Save Modifications for the End: This lesson can be tight on time. Rather than have students modify the code all at once, you can save modifications for the end of the Code Investigation and have students pick a single app they wish to modify.

Accessing Lists - 20 mins

Level 2 - Video: Show the video explaining how to determine the length of a list.

Group: Place students in pairs.

Levels 3 - 4: Band Namer and Outfit Picker Assign half of the pairs to investigate the Band Namer app and half to investigate the Outfit Picker. Each pair should read the app carefully and prepare answers to the questions for their app.

Discuss: Have pairs match up with another pair that investigated another app, forming a group of four. Each pair should spend ~5 minutes walking them through the way that the app works and what they learned specifically from answering each question. Afterwards discuss any open questions that they couldn't answer with the room.

Changing Lists

Level 5 - Video: Show the video explaining how to determine the length of a list.

Levels 6 - Pair Maker: Have all pairs investigate this app on their own, answering the questions listed there.

Discuss: Have pairs match up with another pair forming a group of four. The group should spend ~5 minutes discussing their responses to each of the questions. Bubble up confusion points or open questions to the room.

Modify Apps

If there is time remaining, have pairs return to one or more of the apps and make the suggested modifications.

Wrap Up (5 mins)

Patterns Review

Levels 7-8: Review the patterns in these levels as a class.

  • Have students add any relevant notes about the patterns to their journals.
  • Discuss which of the three apps you think were using which pattern.

Synthesis

Discussion Goal

Goal: Use this discussion to identify any points of confusion that will need to be reviewed in coming lessons.

Prompt: What aspects of using lists do you feel you already understand? What questions do you want to dig into more tomorrow during the practice lesson?

Discuss: Have students write in their journals, then share with a neighbor, then finally discuss as a class.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 3A-AP-14 - Use lists to simplify solutions, generalizing computational problems instead of repeated use of simple variables.
  • 3B-AP-23 - Evaluate key qualities of a program through a process such as a code review.

CSP2021

AAP-1 - To find specific solutions to generalizable problems, programmers represent and organize data in multiple ways
AAP-1.A - Represent a value with a variable.
  • AAP-1.A.3 - Some programming languages provide types to represent data, which are referenced using variables. These types include numbers, Booleans, lists, and strings.
  • AAP-1.A.4 - Some values are better suited to representation using one type of data rather than another.
AAP-1.D - For data abstraction: a. Develop data abstraction using lists to store multiple elements. b. Explain how the use of data abstraction manages complexity in program code.
  • AAP-1.D.1 - Data abstraction provides a separation between the abstract properties of a data type and the concrete details of its representation.
  • AAP-1.D.2 - Data abstractions manage complexity in programs by giving a collection of data a name without referencing the specific details of the representation.
  • AAP-1.D.3 - Data abstractions can be created using lists.
  • AAP-1.D.4 - Developing a data abstraction to implement in a program can result in a program that is easier to develop and maintain.
  • AAP-1.D.5 - Data abstractions often contain different types of elements.
  • AAP-1.D.6 - The use of lists allows multiple related items to be treated as a single value. Lists are referred to by different names, such as array, depending on the programming language. EXCLUSION STATEMENT(EK APP-1.D.6): The use of linked lists is outside the scope