How do you teach the core computer concept of functions to your students?
Share your best practices, hacks, tips and tricks here. Also feel free to share here your questions, half-baked ideas, spectacular failures and concerns about teaching loops.
In your post, be sure to tell us what grade you teach and any other relevant information about your classroom context that will help other understand how they might implement your idea.
In math we use functions all the time. If my students are advanced enough I might discuss the steps it takes to do a long division problem. Or I could do something simpler and talk about a lunch line and the function of each kitchen staffsā job.
I agree with Eric. We use the word function throughout our building in math class. Fortunately, our students have been exposed to this word before and therefore the concept is not as difficult for them to understand. I skipped the sun-catcher unplugged activity when working through this course with my students. However, if the concept and vocabulary was new to my students I would more than likely first work through this lesson.
I might try to connect functions to the current fad of making rainbow bracelets. Different patterns of bracelets each have their respective function. Or, connecting it to LEGO building where functions may be defined and used throughout the process of building a more complex structure. Functions in playing chess may be another interesting way to talk about this topic - for example, a āforkā and a āpin.ā
I really liked being able to pull the chorus with the Little Bunny Foo Foo song and calling it as a function. I could also use the song āThere was an Old Lady who Swallowed a Fly.ā We could call a function for each animal in the song.
I also was thinking of revisiting the playground and writing instructions to move around the playground (I am going to use this for sequences as well) but then having them call functions to get on the playground equipment.
Functions are an interesting concept. It was easiest when I explained it like a copy of art you already created. If you draw a circle, you can continue to ācopyā that circle and use it again when you need it. Almost like a stencil or die cut.
I would like to try introducing functions in the gym. I love the way Chris Bosh explained how in basketball you learn the basics, like how to dribble and pass the ball, then use those skills in different ways and give them a name so everyone on the team knows how/what to do. Students could work in teams to come up with and name their own āskills,ā then teach those skills and their name to other teams. At some point students discuss the fact that they are creating functions. A student calls out a function name like ājump and jiggleā and classmates practice that function.
Most of my 7th and 8th grade students have already learned about functions in their math classes. For those who havenāt caught on, yet, I would use a popular (school appropriate) song. The chorus would be the function.
Really when you think about it, any recipe students already know how to make becomes a function.
Take for example, a student that is focused on mining. He knows how to create a pickaxe. He goes off and mines and eventually his pickaxe breaks. He calls the function āMake a new pickaxeā from his memory and goes off to make one. He does not have to relearn how to make it, since he has that function already stored in memory somewhere.
In kindergarten, first, and second grades, I would ask the students to identify tasks they complete in their daily life which have been given a name that everyone in their family or everyone in the classroom can understand. Examples might be: get dressed, brush your teeth, feed the dog, get ready for PE, pack up to go home from school. Each of those tasks is really a series of steps that we have packaged together and given a name to.
I like the idea of the sun catcher project. I think similar projects could be used at different grade levels to reinforce the concept of functions.
While teaching the Course 3 Functional Suncatcher Unplugged lesson last year to a group of fourth grade gifted students, one of them asked me to explain the difference is between a function and an algorithm. We discussed the similarities, but our discussion regarding what makes them different was hazy. Iād love to hear your thoughts.
Your point that everyday tasks are functions - āa series of steps packaged togetherā - is a great one. Students would really be able to understand that. Iāve had them try to explain how to make a PB&J sandwich before. If they donāt get all the steps, it can be a mess. Same way with a function.
The way Iāve heard it explained is that an algorithm is a set of instructions for a computer to follow, and an algorithm might include a function. Functions are mini-snippets of code you might want to call again and again over many algorithms. Think of it like a āchorusā in a song, that gets ācalledā after each verse. Itās not quite a loop, but it IS a building block of a program. Not sure if I am 100% correct tho. Anyone else have a better explanation?
With 7th and 8th graders, pointing out functions as a way to shorten their code by making their own block helped. Once they made the function for the square and then used the function to draw repeated squares to make a picture, without having to use all of the usual blocks made learning functions a priority.
Mi piacerebbe spiegare il concetto di funzioni ai miei alunni (sia delle scuole elementari che delle medie) utilizzando un pianoforte ed utilizzando delle sequenze di tasti bianchi , tasti neri , pause , cluster di note e battiti di mani . Utilizzando la tastiera del pianoforte gli alunni avrebbero unāampia possibilitĆ di utilizzare suoni diversi.
Skill 1:
Skill 2
Program: Skill 1 Skill 1 Skill 2
Iād say that a function is basically an algorithm with a name.
Going farther, Iād say that we give it a name so that we can tell the computer to do that algorithm using one word, instead of having to type out all of those lines of code every time we want that algorithm to happen.
Going even farther, Iād say that a function can be algorithms within algorithms (or functions within functions). For example: eatBreakfast might be a function that includes the functions setTable, makeToast, and pourCereal, and also algorithms for walking from one part of the kitchen to another, in between those functions.