Skip to content

Latest commit

 

History

History
85 lines (55 loc) · 3.94 KB

lesson_33.md

File metadata and controls

85 lines (55 loc) · 3.94 KB

Lesson 3.3: Customization I: Arguments

Learning objectives

Students will be able to...

  • Build custom blocks that take arguments.

Materials and preparation

Video resources

Pacing guide

Duration Description
5 minutes Welcome, attendance, bell work, announcements
15 minutes Lecture and introduce activity
20 minutes Custom block argument activity
15 minutes Debrief and wrap-up

Instructor's notes

Lecture

Introduce block arguments

  • Define Arguments: An argument is any area in a block that accepts user input, or another block. It could be a Boolean Block or a value placed inside of a variable or block.

  • Ask students to speculate on risks of relying on variables instead of arguments.

  • Variables could be changed by a script other than the custom block, variable names could be changed causing errors, etc.

  • Emphasize importance of custom blocks being self-contained.

  • Custom blocks should continue to function correctly independent of any other changes in the script.

  • Custom blocks should work correctly anywhere in the script and not require specific setup or cleanup.

  • Point out how complicated a script would be if blocks like move 10 steps required setting a variable with a specific name to work.

    Move 10 steps block

Demonstrate declaration and usage of arguments

Point out that arguments are very similar to variables, except their values come outside the block.

Explain argument types.

  • Only discuss text, numbers, and Booleans.
  • Other types can be mentioned, but won't be used in the course.

Ask students to describe why restricting types is important.

  • Point out that arguments are passed by value.
  • Specifically, changing the value of an argument inside a custom block will typically NOT change the value at the call site.

Arguments example

  • Basic argument in pen category.
  • Pass by value example in "Variables" category.

Activity

Students should complete the Let Me Check My Calendar activity individually or in pairs.

  • This lab consists of a series of independent custom blocks. The blocks need not necessarily be completed in the order given, but are roughly in order of difficulty.

The bonus requires implementing a fairly complex formula.

Debrief

  • Ask a different student to provide their solution to each part.
  • If time allows, discuss multiple solutions to each part.
  • Emphasize differences and encourage discussion about advantages and disadvantages.
  • Point out corner cases and cases where typed arguments are particularly helpful.
  • For example, avoiding try to find out whether "bubblegum" is a leap year.

Accommodations and dfferentiation

  • Part 3.4 is a fairly complex formula and should be a challenge for advanced students.
  • Struggling students should focus on section 1. The problems in section 2 represent more complex algorithms, but not necessarily any more difficult usage of arguments.