“Papa . . . What do you do for a living?”
It’s a question that comes out of nowhere and makes every parent proud. It’s one of the first signs that your child sees you as a person and not just a caretaker.
“I’m a web developer.”
Let’s go back in time three years . . .
“I’ll teach him how to code!” I thought.
Parents like teaching their kids — it’s instinctual. We teach them language, values, skills, how to throw and kick a ball and many important life lessons as they grow up.
What about computer programming?
It’s not as glamorous as building a house. It’s not as instantly fun as assembling a LEGO car, opening a fresh pack of Play-Doh, or experimenting with a classic Erector set. However, it is a form of creativity and expression — I can use computer programming to make something that wasn’t there before, using a set of tools.
He started with Scratch from MIT’s Lifelong Kindergarten group. For those unfamiliar, Scratch is a block-based, visual programming community for kids. It’s very fun and intuitive — like connecting LEGO bricks. Kids can quickly get started making games, stories, and animations then share their creations within the Scratch community (over 18 million projects have been shared on scratch.mit.edu). A big thank you to the Scratch Team for providing such an excellent platform! He spent at least two years “Scratching” — and still does today.
Ah . . . The big moment! Moving from the warm and cozy world of Scratch visual programming to the stark, cold and unforgiving world of typing plain text, the command line and cryptic error messages. Where, in the time it used to take to build a something interactive in Scratch (complete with fart sounds), you can output “Hello World” to the console.
Moving from Scratch to Text. It’s a big change!
I’ll never forget his first steps . . . or his first programming language.
I read the recommendations and selected Python.
My first programming language was BASIC on an Apple IIe. I remember spending hours typing pages of code from magazines and books — and debugging all the typos — just to play simple dungeon games. The games weren’t even that fun and always seemed to crash with syntax errors, but it was the closest we had to actual computer games and that made it worth the effort!
I re-purposed an old laptop and installed Python and Sublime. (I actually took his mother’s laptop and gave her the old one. She only uses the web browser and Office anyway.)
His Scratch skills transferred well — control flow, variables, conditionals, loops and lists. It’s amazing how much he learned in Scratch, while having fun.
All was going well — until he stopped.
He just lost motivation. I guess command line output only motivates a kid so much these days. The games in Part II of the book just couldn’t compete with Scratch — let alone Xbox!
Looking back, I would still start with Python and the same book, since it was a great experience for both of us and I’m sure he will pick it up again in the future — Python has so many uses.
But I was determined . . .
I remember showing him how to “View Source” on his favorite websites. He seemed most excited after learning how to change content on web pages with Chrome DevTools . Adding “poop” to the headings of actual web pages is very compelling for kids!
After a few months, his momentum really slowed. Web development is a pretty broad topic and I needed some help. I signed up for CodeSchool and hoped for the best. It turns out their mix of original music/jingles, slow-paced video training and in-line exercises works really well for my son. Although, there are times when he just plays the jingles over and over again and searches the site for new ones — CodeSchool jingles are good!
Kids relate well to things in the real world. As we worked through the books and exercises, I found myself translating various abstract computer programming concepts into familiar scenarios.
Below are some of the explanations that worked for my son — hopefully, I didn’t mess him up too much.
VariablesNothing too exciting here. The “variable is a container” analogy worked very well.
“Arrays can also hold objects. You can make an Array of your entire class that contains 30 Student objects then use a loop to print out all of the students in your class.”
Functions“Functions are like cooking recipes or the instructions that come with a LEGO set. Running a function goes through each of the steps until it reaches the end or is told to stop — like when we call you down for dinner!
A ‘bake-a-chocolate-chip-cookie()’ function includes all the steps required to bake a chocolate chip cookie — gathering and preparing ingredients, mixing, placing on baking tray, preheating oven and baking.”
Parameters “Parameters are like bits of information you share with your functions — giving them extra powers. Instead of having to write a separate ‘bake’ function for every type of cookie, you can write one ‘bake()’ function and tell it which type of cookie to bake as a parameter — bake(‘chocolate_chip_cookie’).”
*Don’t get too bogged down in the difference between parameters and arguments; it’s not worth it at this point.
My first explanation attempt:“A closure is like a dinosaur fossil — a snapshot from a moment in time preserved for millions of years. You can get still get information about the dinosaur from the fossil, even though the dinosaur itself has been gone for millions of years.”
Closures were starting to make sense, so I tried using cookies again . . .
“Let’s say I go to the same bakery every day and ask the baker for a cookie. The first thing he/she asks is, ‘What kind of cookie do you want?’ After a few days, the baker might already know what cookie I like and simply ask, ‘The usual?’. By saving my cookie choice in memory, he/she is able to reuse the same function from the previous day to get me the proper cookie without having to ask again.”
Eh… It was still a bit fuzzy, until my son asked me…
“So, it’s like when we go to the barber and he just cuts our hair without asking what we want? He always asks new customers how they want him to cut, but never asks us anymore.”
Ding, ding, ding! He got it!!!
After finishing the remaining CodeSchool exercises, it all started coming together — for both of us.
Coding is a craft. Like any activity you sign your kid up for, it takes practice, patience and commitment—not always the easiest things for kids.
We’re still at the beginning of the journey, but moving along.
We attended an indie game event recently and he was inspired to make games. He starting watching some Unity videos, but that dropped off rather quickly.
I try to not to limit his propensity to pivot and experiment with new things.
The next big step for him is to build a real application. His first shipped MVP — another milestone! Who knows when or if that will ever happen or what it will be, but I’ll hope for the best and support him along the way.
Now it’s time to start the journey with his younger sisters!