This lesson covers functions as a way to organize code, make it more readable, and remove repeated blocks of code. The class learns that higher level or more abstract steps make it easier to understand and reason about steps, then begins to create functions in Game Lab. At the end of the lesson, the class uses these skills to organize and add functionality to the final version of their side scroller game.

Note: You will need to create a free account on code.org before you can view this resource.

Content Standard(s):

Digital Literacy and Computer Science DLIT (2018) Grade: 6

2) Define a process as a function.

Example: Functions or sets of steps combined to produce a process: turning off your alarm + getting out of bed + brushing your teeth + getting dressed = morning routine.

Unpacked Content

Evidence Of Student Attainment:

Students will:

list a set of steps taken to complete a process and name that process as a function.

Teacher Vocabulary:

process

function

Knowledge:

Students know:

that often people seek to simplify processes; rather than listing all of the steps needed to take a shower, one simply uses the function "shower".

Skills:

Students are able to:

combine or join steps such as algorithms to create a function.

Understanding:

Students understand that:

it is simpler and less confusing to identify processes rather than steps.

Digital Literacy and Computer Science DLIT (2018) Grade: 6

5) Identify algorithms that make use of sequencing, selection or iteration.

Examples: Sequencing is doing steps in order (put on socks, put on shoes, tie laces); selection uses a Boolean condition to determine which of two parts of an algorithm are used (hair is dirty? True, wash hair; false, do not); iteration is the repetition of part of an algorithm until a condition is met (if you're happy and you know it clap your hands, when you're no longer happy you stop clapping).

Unpacked Content

Evidence Of Student Attainment:

Students will:

find algorithms that demonstrate the three basic programming structures.

Teacher Vocabulary:

algorithm
sequence
selection
iteration

Knowledge:

Students know:

differences between the three basic programming structures.

Skills:

Students are able to:

explain the differences in sequencing, selection, and iteration.

Understanding:

Students understand that:

differences exist in sequencing, selection, and iteration.

Digital Literacy and Computer Science DLIT (2018) Grade: 6

21) Identify varying data structures/systems and methods of classification, including decimal and binary.

Examples: Difference between a bit and a byte, bit representation, pixels.

Unpacked Content

Evidence Of Student Attainment:

Students will:

recognize various data structures and methods of classification such as binary and decimal.

Teacher Vocabulary:

data structures

decimal

binary

Knowledge:

Students know:

how to recognize a binary number system including bits and bytes.

Skills:

Students are able to:

identify how binary can be used for bit representation in pixels.

Understanding:

Students understand that:

there are several data structures and methods for classification.

Digital Literacy and Computer Science DLIT (2018) Grade: 7

1) Create a function to simplify a task.

Example: Get a writing utensil, get paper, jot notes can collectively be named "note taking".

Unpacked Content

Evidence Of Student Attainment:

Students will:

summarize a collection of steps or algorithms as one function.

Knowledge:

Students know:

an algorithm is the set of commands to complete a task.

Skills:

Students are able to:

combine several algorithms or tasks as a named function.

Understanding:

Students understand that:

it is more efficient to label an activity or program as a function than to list all of the individual steps or algorithms that make up the function or activity.

Digital Literacy and Computer Science DLIT (2018) Grade: 7

4) Design a complex algorithm that contains sequencing, selection or iteration.

Examples: Lunch line algorithm that contains parameters for bringing your lunch and multiple options available in the lunch line.

Unpacked Content

Evidence Of Student Attainment:

Students will:

design complex algorithms that demonstrate the three basic programming structures: sequencing, selections, or iterations.

Teacher Vocabulary:

algorithm

sequence

selection

iteration

Knowledge:

Students know:

how to use the programming structures to design complex algorithms that make use of all three programming structures sequencing, selections, and iterations.

Skills:

Students are able to:

design complex algorithms using the various programming structures found in algorithms.

Understanding:

Students understand that:

complex algorithms contain sequencing, selections, and iterations.

Digital Literacy and Computer Science DLIT (2018) Grade: 7

5) Solve a complex problem using computational thinking.

Unpacked Content

Evidence Of Student Attainment:

Students will:

break a problem into parts or steps.

find patterns or trends.

create steps to solve the problem.

infer rules or principles associated with problem solving.

Teacher Vocabulary:

computational thinking

Knowledge:

Students know:

smaller tasks are easier to solve than complex problems.

that trends in data can also speed up the problem-solving process.

Skills:

Students are able to:

abstract portions of the problem and focus on smaller tasks to aid in solving a complex problem.

Understanding:

Students understand that:

complex problems can be overwhelming.

by decomposing the complex problem into simpler problems, a solution is easier to reach.

Digital Literacy and Computer Science DLIT (2018) Grade: 8

1) Design a function using a programming language that demonstrates abstraction.

Example: Create a program that utilizes functions in an effort remove repetitive sequences of steps.

Unpacked Content

Evidence Of Student Attainment:

Students will:

design a function that demonstrates the removal of repetitive sequence of steps.

Teacher Vocabulary:

function

abstraction

Knowledge:

Students know:

that a function can be called into a programming while abstracting out the details contained within the function.

Skills:

Students are able to:

create a function that can be called into a programming while leaving out the details contained within the function.

Understanding:

Students understand that:

abstraction is a way of hiding the details of a complex function and being able to quickly make use of the complexity that has been hidden abstraction by calling in the function.

Digital Literacy and Computer Science DLIT (2018) Grade: 8

5) Discuss the efficiency of an algorithm or technology used to solve complex problems.

Unpacked Content

Evidence Of Student Attainment:

Students will:

examine a given artifact used to aid in problem solving.

discuss the efficiency of that artifact in problem solving.

Knowledge:

Students know:

that many solutions exist to solve a problem.

Skills:

Students are able to:

communicate their opinion on the efficiency of problem solving methods.

Understanding:

Students understand that:

while many solutions exist for a problem, some are better suited to meet specific needs, such as efficiency.

Digital Literacy and Computer Science DLIT (2018) Grade: 8

7) Create a program that includes selection, iteration, or abstraction, and initializes, and updates, at least two variables.

Examples: Make a game, interactive card, story, or adventure game.

Unpacked Content

Evidence Of Student Attainment:

Students will:

create a properly functioning program using selection, iteration, abstraction, that initializes and updates at least two variables.

Teacher Vocabulary:

selection

iteration

abstraction

initialize

variables

Knowledge:

Students know:

how to write a program that includes selection, iteration, abstraction, initialization, and updates variables.

Skills:

Students are able to:

write a program that includes foundational programming concepts

selection, iteration, abstraction, initialization, and updating variables.

Understanding:

Students understand that:

they have the ability to create and design programs they may have never considered themselves able to do so.