Lesson 4.9 Functions explore/investigate
Oct 4 (A-day) and Oct 5 (B-day)
Oct 4 (A-day) and Oct 5 (B-day)
Bubble 4 you are to recognize where the function is DECLARED and where it is CALLED.
Bubble 5 you will have to
find the code that repeats and
drop one set into a function,
add the call the function necessary in the body of your program and
delete the extra set of coding.
Function: a name of a group of programming instructions. Also referred to as a "procedure."
Function Call: a command that executes the code within a function
New code block:
updateScreen()
Manages the Complexity of a Program by
fixing code problems throughout by just updating the function code (you will need to give an example within your code - use comments)
writing the code one time and being able to use it when needed rather than rewriting the same code over and over. (You will need to give an example within your code - use comments)
Students begin the lesson by considering two ways to write out the lyrics of a song, one that includes a lot of repeated text and one that does not. After exploring this example students complete a series of investigate activities in which functions have been used to remove repeated code from a program. At the conclusion of the lesson students discuss the concept of a function to synthesize their learning and add definitions to their journal.
This lesson is both the Explore and Investigate components of the EIPM sequence for functions. Functions are best understood by actually using them in a program, and so while the Explore component is relatively shorter, students actually are given many opportunities to observe how functions are used in programs. There is a heavy emphasis on running programs slowly to see how functions change the order in which programs run.
CSP Conceptual Framework
AAP-3 - Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing programmers to write programs more quickly and with more confidence.
AAP-3.A - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
3A-AP-17 - Decompose problems into smaller components through systematic analysis, using constructs such as procedures, modules, and/or objects.
3B-AP-23 - Evaluate key qualities of a program through a process such as a code review.