Lesson 3.5: Customization II
Learning Objectives
Students will be able to...
- Build custom reporter and predicate blocks in SNAP
Materials/Preparation
- Lab 3.5 handout (If My Calculations Are Correct...) (Download in Word) (Link to PDF)
Pacing Guide
Duration | Description |
---|---|
5 minutes | Welcome, attendance, bell work, announcements |
10 minutes | Lecture and introduce activity |
25 minutes | Custom reporter activity |
15 minutes | Debrief and wrap-up |
Instructor's Notes
- Lecture
- Introduce reporter blocks
- Ask students to find blocks with the reporter shape (round) and speculate as to what they do
- Point out familiar examples, such as
,
,
, etc.
- Point out familiar examples, such as
- Explain the concept of reporting (returning) a value, and how reporter blocks are used to provide values to commands
- Emphasize that reporters do not (and should not) perform any action—they are used to compute values which are in turn used by commands
- Ask students to find blocks with the reporter shape (round) and speculate as to what they do
- Introduce predicate blocks as a special case of reporter blocks
- Emphasize that predicates must return true or false
- Be aware, but don't necessarily tell students, that SNAP does not enforce this
- Point out examples, such as
,
,
- Ask students why it might be useful to differentiate predicates from other reporters
- Only predicates can be used in a conditional
- Emphasize that predicates must return true or false
- Introduce reporter blocks
- Activity
- Students should complete the "If My Calculations Are Correct..." activity individually.
- This lab consists of a series of independent custom blocks. The blocks need not necessarily be completed in the order given.
- Work with students to ensure they are testing their blocks properly and reporting correct values.
- Part 2.2 is challenging and requires traversing a String.
- Students should complete the "If My Calculations Are Correct..." activity individually.
- Debrief
- Ask a different student to provide their solution to each part. If time permits, go over multiple students' work for each part.
- Point out differences and discuss advantages and disadvantages to different approaches.
- Emphasize that custom blocks do not have to be long and complicated to be useful.
- Ask a different student to provide their solution to each part. If time permits, go over multiple students' work for each part.
Accommodations/Differentiation
- Struggling students should focus on just the first 2 or 3 parts of the lab. Even if they cannot move on to the more difficult problems, getting used to defining custom reporters is helpful and important.
- Advanced students who finish quickly can be utilized to assist other students.
- Students who struggle in math may not be familiar with the distance formula used in part 2.1. Help students to translate the math into SNAP code, but understanding the formula and its applications is not necessary for the activity.
- If most students are not equipped to handle this math, a simpler computation, such as area of a triangle or average of three numbers, can be substituted.