Lesson Plan: Chapter 18
Connecting to CSTA Standards
Grades | Concept | Subconcept | Standard Number | Practice |
---|---|---|---|---|
6-8 | Algorithms & Programming | Modularity | 2-AP-14 | Developing and Using Abstractions: 4.1, 4.3 |
6-8 | Algorithms & Programming | Program Development | 2-AP-18 | Distribute tasks and maintain a project timeline when collaboratively developing computational artifacts: 2.2 |
Create procedures with parameters to organize code and make it easier to reuse.
Students should create procedures and/or functions that are used multiple times within a program to repeat groups of instructions. These procedures can be generalized by defining parameters that create different outputs for a wide range of inputs. For example, a procedure to draw a circle involves many instructions, but all of them can be invoked with one instruction, such as “drawCircle.” By adding a radius parameter, the user can easily draw circles of different sizes.
Distribute tasks and maintain a project timeline when collaboratively developing computational artifacts.
Collaboration is a common and crucial practice in programming development. Often, many individuals and groups work on the interdependent parts of a project together. Students should assume pre-defined roles within their teams and manage the project workflow using structured timelines. With teacher guidance, they will begin to create collective goals, expectations, and equitable workloads. For example, students may divide the design stage of a game into planning the storyboard, flowchart, and different parts of the game mechanics. They can then distribute tasks and roles among members of the team and assign deadlines.
Learning Outcomes/Goals
In this chapter, students continue work on their winding story line in Twine. They will use parameters to add sound and graphics to their story and work with a team to continue to develop its trajectory. They also can continue to work in their team to enhance the design of their story with crowdsourced backdrops.
Differentiated Instruction
Lower level students | Higher level students |
---|---|
Can complete the project as defined in the recipe | Can enhance the project by experimenting with other Twine libraries to add, using parameters to customize the interface |
Transfer Learning
In this chapter, students use third party libraries to enhance their codebase. This is a good moment to look at Twine's ecosystem, perhaps comparing it to MakeCode or micro:bit's, which you used earlier. What are the types of plugins that are available for these type of projects?
Vocabulary
- Code smells: A so-called 'code smell' "is any characteristic in the source code of a program that possibly indicates a deeper problem.[1][2] Determining what is and is not a code smell is subjective, and varies by language, developer, and development methodology." source
- Spaghetti code: Difficult-to maintain source code due to disorganization, complexity, poor naming conventions, lack of documentation, confusing syntax, or other. source
Assessment
Students can be tested on their grasp of the use of parameters and their recognition of code smells and the need to refactor
Formative | Summative |
---|---|
Research an example of code from Refactoring Guru and suggest ways to improve it by removing 'dirty code' or 'code smells'. | Write a summary of a few ways that a given piece of code could be refactored. |
Quiz Answers
Q1: Writing your code as reusable elements allows you to
a. Make your code more readable
b. Make your code more maintainable
c. Both of these
Q2: A parameter can be used in a function to
a. Reuse the function
b. Create switches in the code
c. Pass in a value for processing
Q3: A so-called “code smell” is code that
a. Features decomposition
b. Causes degradation of the code
c. Will cause problems down the road as it is badly written
More Resources/Materials
Solution Code
The Google Drawing used in this lesson can be seen here.
Assignment and Rubric: Building Inventory
Continue to complete your own version of your story about the underground world as you progress through the passages, adding various moments where you can collect and drop inventory items. You can even add dead ends where a dropped item causes some problem, and the passage has to be restarted. Be as creative as you like, remembering that we will be adding a way for the collection of some keys to be contingent on the collection of certain items in the next chapter, so plan your story accordingly.
Exemplary | Adequate | Needs Improvement |
---|---|---|
The student uses creativity to enhance their story with at least five more passages | The student enhances their story with just a few extra elements | The student creates only the story as written in this textbook |
*tip: prior to saving as a PDF, select the 'light' mode at the top using the 'sun' icon.