Teaching functions

I’d mentioned utilizing music and teaching computer science together a couple posts back, so I loved the example of using choruses as named functions. I think young students can see that when they learn, and they combine things they’ve learned, they too are sort of calling functions. If kiddos have lists of chores at home, they have a sort of named function there. Instead of writing each step to emptying a dishwasher, you can just ask someone to empty the dishwasher, and they know what you’re talking about. Similarly, we can NEST functions in this way, just like we do with loops.

The combination of students learning directly from the teacher about defining, ‘calling’, and singing choruses and then writing their own choruses from popular or well-known songs is a great addition to the ‘facilitator’ module. It gives the impression that we’re all learning and working together in the classroom, which is a key element of becoming a good computer scientist.

A small gripe for any support that might read this: I noticed that the link to “1. Review “Functions:Songwriting” Lesson Plan: Course D” at https://studio.code.org/s/K5-OnlinePD/stage/7/puzzle/9 inadvertently links to https://levelbuilder.code.org/curriculum/coursee/6/Teacher

A little hunting and poking around finds the correct lesson, but the lesson linked currently deals with loops! Just a bit confusing - the lessons at the bottom appear to link to Course E lesson plans instead of Course D - unsure if this is intentional.

Being in an elementary school, I think functions could potentially be difficult. I think that using a chorus as an example might be a good place to start. I also like the idea of incorporating art. I can use the idea of copying and pasting different shapes to create pictures. The initial shape I create would be the FUNCTION I name, and then I copy it, rather than trying to recreate it, exactly, multiple times. I could even talk about using templates that we trace - if we’re going unplugged.

In Kindergarten math, we learn about function machines. Functions “machines” are where you would apply the same rule to any number that goes in. A rule could be “+1.” If 5 goes in, 6 comes out. If 7 goes in, 8 come out and so on. I believe that my students could easily make the connection between applying rules to numbers to applying the “functions” in coding.

I love the song writing example. There are a lot of sounds out there right now that have more functions than lyrics. It would be fun to challenge the students to find some examples.

I really liked the songwriting demonstration. It made sense to compare it to a song that the children know. I want to try this with my students before adding to the ideas.

Functions allow students to identify specifically the task. This make others understand the relevant idea needed in the program

Relating the function to the chorus of a song is a great idea!

Teaching functions to 1st graders. I really like the songwriting lessons with I’m a nut and Old Macdonald. Teaching them steps and then how to make those basic repeated steps almost abbreviated. Another idea I had with teaching the functions would be having kids talk about the process it takes in making a sandwich. There might be some parameters and functions we could discuss. Any real world applications will help them.

I think I mostly use functions when it comes to making mind maps or any kind of graphic organizers. When you use lines or “y’s” to add more information you are using a function, it expands the information.

Functions in our science curriculum are introduced as the job that something does. For teaching functions in coding I would talk about how they save us time and save us from repeating ourselves.
For teaching how you don’t say the function or parameters directions out loud I would use this chorus lesson or a reader’s theater with staging directions and actor directions. Also I may use the first 30 seconds of this clip of Joey on Friends.

I like the idea of using a Minecraft recipe as a function. Even students that don’t play understand the idea of recipe and can understand repeating the steps to make something.

I haven’t taught the coding lessons yet, but I think using a song would be a great way to teach functions. i like how the video showed an unfamiliar song first and then followed up with a familiar.

As stated in the video, I would state that a function is part of a program that can get repeated anywhere in the program so that the programmer doesn’t have to retype the code over and over again. Some kind of unplugged activity would need to be done, in order for my students to understand the concept.

I teach year 5 & 6 students and like the idea to use simple songs known to the students, or easy to learn. Knowing the song will help to avoid information overload. I would follow this up with the sun catcher activity as the students love hands-on activities. I would use teaching moments as the come up across the curriculum to consolidate these concepts: functions & variables.

Song is agood method to explain about function concept. I will give example with it :slight_smile:

I would say condense or shorten/make smaller the job by putting anything that is repeated over and over again into one small package that you can grab when needed. I will try using jumping jacks as my teaching vehicle.

Thank you for the Functional suncatchers lesson, I would surely use it for my students as I myself did.

I teach pre-k thru 1st grade. The idea of functions might be a little much for them. Though I liked the suncatcher activity as a way to introduce the idea. I have also started a girls who code group and I see that as a great way to engage the girls into learning the concept. It can also be used in conjunction with patterns. Establish a simple A, B pattern then expand it by giving A a specific pattern and then another expanded pattern for B. Kindergarten and First Graders work with patterns and this could be a great way to introduce functions.

To be honest, I have never done functions before. So, it would be easier for me to let the students watch the video before we start with the module. Once we have watched the video together, we will then find other interesting and relevant activities that we can link to this.

The video I just saw using Old Macdonald was really a great way. I will use it when I start teaching my group. For the older math functions may be useful. I can see this is games where kids are building structures and need to use say window construction over and over. These ideas may be far fetched at this stage.