The Trick to Teach Anonymous Functions to 11-Year-Olds
“Is this coding advanced?” Jenny asked.
Jenny smiled. She liked this game of me naming the concepts she was using with fancy technical terms.
“And here, I almost forgot. You’re using no less than 1, 2, 3…15 anonymous functions!”
In computer science, a anonymous function is considered a fairly advanced topic. Many computer science majors in college don’t learn it until their upper-level courses, if at all. I wanted to check how well Jenny knew what she was talking about.
“Jenny, all of these things are called anonymous functions. Do you know what they do?”
Jenny looked at her code. “Um, I’m not sure. I just use them when I want something to happen.”
I laughed. It’s not a definition that would pass on a computer science exam, but it was a solid working definition that clearly allowed her to use them effectively.
Embrace the Mess
Learning a spoken language — be it English, Spanish or Chinese — is a messy process. At its best, learning a computer language is equally messy.
Imagine what it would’ve been like if you had to understand grammar — nouns, verbs, sentence structure, and punctuation — before you were allowed to speak your native language. That’s often what coding education looks like. First, let’s learn about coding — variables, if-statements, types — and then start coding after.
But that’s entirely backward. Learning a language, both spoken and computer, should first be a doing activity, and secondly an analytical activity. What this means is deliberately not teaching about concepts like anonymous functions before letting students loose to use them.
Will this result in students getting things wrong at first? You bet.
Will students get confused and frustrated? No doubt.
Will students be able to recite dictionary definitions? No chance.
But despite all this, learning the messy way — a common feature of project-based learning environments — is more effective and drastically more fun.
Instead of spending hours memorizing and googling new syntax, Woof provides a clear interface for students to learn through exploration and experimentation.
So the trick to teaching anonymous functions to 11-year-olds? Don’t. With Woof, they’ll figure it out themselves better anyway.