Using Extensions
Summary
- Day 4 PowerPoint deck
- Football (for teacher)
- My Extension (for teacher)
- Making and Using Extensions handout
- Making and Using Extensions handout in Word
- Activity: Making and Using Extensions
- Resource: Defining Blocks
Instructional Activities and Classroom Assessments
- Introduce Extensions (5 minutes)
- Learn How to Create and Use Extensions (15 minutes)
- Activity: Using extensions (30 minutes)
- Reflection/Homework
Learning Objectives
Essential Knowledge
- AAP-3.A.1 A procedure is a named group of programming instructions that may have parameters and return values.
- AAP-3.A.2 Procedures are referred to by different names, such as method or function, depending on the programming language.
- AAP-3.A.4 A procedure call interrupts the sequential execution of statements, causing the program to execute the statements within the procedure before continuing. Once the last statement in the procedure (or a return statement) has executed, flow of control is returned to the point immediately following where the procedure was called.
- AAP-3.B.1 One common type of abstraction is procedural abstraction, which provides a name for a process and allows a procedure to be used only knowing what it does, not how it does it.
- AAP-3.B.2 Procedural abstraction allows a solution to a large problem to be based on the solutions of smaller subproblems. This is accomplished by creating procedures to solve each of the subproblems.
- AAP-3.B.4 A procedural abstraction may extract shared features to generalize functionality instead of duplicating code. This allows or program code reuse, which helps manage complexity.
- AAP-3.D.1 A software library contains procedures that may be used in creating new programs.
- AAP-3.D.2 Existing code segments can come from internal or external sources, such as libraries or previously written code.
- AAP-3.D.3 The use of libraries simplifies the task of creating complex programs.
- AAP-3.D.4 Application program interfaces (APIs) are specifications for how the procedures in a library behave and can be used.
- AAP-3.D.5 Documentation for an API/library is necessary in understanding the behaviors provided by the API/library and how to use them.
Details
1. Introduce extensions (5 minutes)
- Explain the difference between a pre-made function and a student-made function.
- Remind students what procedural abstraction is.
- Define Extensions.
- Explain how extensions assist in writing code.
2. Learn how to use and create extensions (15 minutes)
- Demonstrate how to add extensions to projects.
- Guide students to learn how to:
- Create a simple football game using the darts extension.
- Use existing code segments in another project by adding them as an extension.
3. Activity: Writing functions with parameters (30 minutes)
- Direct students to their Making and Using Extensions page.
- Task students with completing Tasks 1, 2a, and 2b.
- If students have time, encourage them to complete the extensions activities for both tasks (coding in JavaScript).
4. Reflection/Homework
If you run out of time, you may also assign this as individual homework. Students should complete their reflection.
- How could sharing and importing projects help manage a group project with four or more students?
- What is one benefit to importing code from a project versus just copying the code into the project? You might find it useful to discuss task #2 in your response to this question.