Lesson 11: Functions Make
45 minutes
Overview
Using Programming Patterns and a step-by-step approach students make their own version of a Quote Maker app. At the beginning of the lesson students are able to explore a working version of the app. They are then given the design elements of the app but begin with a blank screen. Students use an Activity Guide to go through the high level steps they should use to develop their app but leaves it to them to decide how to write the code. At the end students submit their apps and answer a free-response question in the style of a Create performance task written response prompt. Student apps and written responses can be assessed using a provided rubric.
Standards
AP - Algorithms & Programming
- 2-AP-19 - Document programs in order to make them easier to follow, test, and debug.
- 3A-AP-17 - Decompose problems into smaller components through systematic analysis, using constructs such as procedures, modules, and/or objects.
- 3B-AP-14 - Construct solutions to problems using student-created components, such as procedures, modules and/or objects.
Agenda
Objectives
Students will be able to:
- Implement a function using programming patterns while developing a functional app
- Recognize the need for a function to reduce repeated code while developing a functional app
- Use debugging skills as part of developing an app
- Write comments to clearly explain both the purpose and function of different segments of code within an app
Preparation
- Review the Activity Guide to decide if you will use it with your students
- Review the Free-Response Supports and consider which, if any, supports are suitable for your classroom.
- Check the "Teacher's Lounge" forum for verified teachers to find additional strategies or resources shared by fellow teachers
- If you are teaching virtually, consider checking our Virtual Lesson Modifications
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the teachers
- App Code Support - Quote Maker App - Handout
- Functions Make - Slides
- Guide to Make Lessons - Video
- Writing Support - Quote Maker App - Handout
For the students
- CSP Functions Make - Quote Maker App - Activity Guide
Teaching Guide
Warm Up (2 minutes)
When to Make Functions: The end of the previous lesson and the beginning of this lesson both emphasize a transition students will go through in making functions. Early on they are likely to either not use functions or only realize the need one after they've already written duplicate code. As they get more experienced as programmers, however, they will likely realize sooner and sooner in the process that a function will be necessary. As students grow more experienced they should actually be able to anticipate and write their functions from the beginning of designing their program. Use this brief introduction to reinforce that language.
Anticipating Functions
Remarks
For the past few days, we've learned a lot about using functions to simplify code and make it easy to edit. So far we have learned how to use functions to remove repeated code in our programs. Early on it's common to realize you need a function only after you've completely written the same chunk of code in two places. As you get better, however, you'll realize sooner and sooner in the process that you're likely going to need a function, and will be able avoid writing repeated code before putting it inside a function. Eventually you'll want to anticipate what your functions are going to be even before you start programming. These are the "during" and "before" levels we read about yesterday.
In today's Make lesson and the following project you'll have a chance to practice this. See if sometimes you can work that "during" or "before" category.
Activity (38 minutes)
Build the Quote Maker App
Group: Make a determination as to whether this project will be completed in pairs or individually. You may even choose to let students decide.
Do This: Have students explore the working Quote Maker App in Level 1.
If students are not working in pairs they should still discuss the prompts with a neighbor.
Discuss:
- What does this app do?
- Display a quote with user-defined fonts and background colors.
- What are the inputs?
- The dropdowns for background color and font family.
- The quote text field
- The slider to generate the font size
- What are the outputs?
- The fully designed quote displayed at the bottom of the screen
- How could a function be used in this app?
- Students may struggle with this question, and it's ok to not have it fully answered before beginning the project.
- A function can be used to update the screen.
- The function contains the conditional that is checked everytime the user interacts with the screen.
Supporting Students: While students are working on their apps, circulate the room and check in with students who need a little help. Encourage students to collaborate and discuss bugs with each other.
Debugging: Review with students steps they can use to debug if they get stuck:
- Run the code on turtle mode
- Add the variables to the watcher
- Explain the code to a friend
Remarks
Now let's build the this app. The screen has been set up for you - it's your job to add the code!
Do This: Direct students to level two where they complete the Quote Maker App. An optional Activity Guide is provided if students would like guidance in creating the app. The most relevant programming pattern is displayed on a slide. Review this pattern quickly with students, if needed.
Submit: Encourage students to check the rubric on the last page of the Activity Guide before submitting.
Adapting Make Lessons - You may decide that you'd like to have your students write the code for a modified or entirely different app using the same skills. This might help you differentiate your instruction or provide you with a way to reassess students. Check out the Customize Make Lessons: How-To-Guide for guidance on how to get started with this.
Wrap Up (5 minutes)
Create Performance Task Written Response Practice
Remarks
Great work on your Quote Maker app today. Before wrapping up, we will be practicing writing for the style of questions that are asked as part of the Create performance task on the AP exam. Respond to the question in Step 5 in your activity guide, and submit it along with your project.
Do This: Complete the written response in Step 5 of the Activity Guide.
Each student, in every classroom, will come to the written response with a different level of comfort, ability, and familiarity with writing for these style of questions. As such, consider offering one or more of the following supports:
Writing Support: Provide students with these sentence starters for guiding their response.
App Code Support: For students who did not fully complete their app, provide them with this snippet from the exemplar code.
Student responses can be used as a formative assessment to evaluate their understanding of connections between user interface features and functionality. Review their explanations for clarity, accuracy, and alignment with the AP exam’s expectations. The provided rubric can be used to guide this review, and to help provide students with feedback to guide their learning and improvement.
Assessment: Make Project
Use the rubric provided with the project to assess student projects.
This work is available under a Creative Commons License (CC BY-NC-SA 4.0).
If you are interested in licensing Code.org materials for commercial purposes contact us.