Kids n' Code - Version 2.0

01/15/2018 11:04 am ET

In the run-up to the holidays it was once again “Computer Science Education Week”, an annual event which in the words of its Twitter label (@CSEdWeek) recognizes “the transformative role of computing and the need to bolster computer science at all educational levels”. For many it (and various other weeks and months that recognize various groups, subjects, achievements, etc.) present a nice opportunity for the public and “the academy” to engage with local schools.

Last year I, along with some of my Dartmouth College Department of Computer Science colleagues, used this as an opportunity to collaborate with the local Hanover, NH elementary school, to bring a little computer science programming (sorry for the CS pun!) to the 4th and 5th graders. This year our numbers swelled from 4 faculty to 6 and we brought activities to students in grades 2 through 5 and even Kindergarten. The activities varied. My colleague Deeparnab Chakrabarty played a scaled-down computationally styled version of MasterMind with two separate classes of fourth graders. My colleague Xia Zhou talked to the fifth graders about being a computer scientist and her work on computing with light. Amit Chakrabarti had the fourth grade act out the Chinese Remainder Theorem in a scenario that would mimic a legendary the historical activity in China from which the result gets its name. Mike Casey worked with the fourth graders to make a small program that allowed them to play a game of “Siri Says”. My colleague Gevorg Grigoryan is poised to talk about the idea of “simulation” with the Kindergarteners (!) through the analogy of animation.

Last year I introduced the idea of sorting to the fourth and fifth grade – having them act out the algorithms for “Insertion Sort” and “Quicksort” – as a way to get them to think about the idea of an algorithm. I decided that this time I would take on the challenge of engaging the lower grades – grades 2 and 3 (80-90 students in each case) – in the exercise. I had learned a bit from my interactions last year and by most accounts things went more smoothly this time. I thought it might be worth sharing some of my experience for anyone who wants to give it a spin in her or his own community – remember, it doesn’t have to be CSEdWeek to have a reason to bring computer science to the schools.

I wanted very much to get the idea of an algorithm across to the kids – pitching an algorithm as a recipe or a set of instructions – doing my best to drive home the point that “computers are dumb and that they only do exactly what you tell them to do!” (Parents, you might also like this book.). Ok, now some of you reading this may want to stop me, to point out the place of randomness, stochastic algorithms, machine learning, etc. This brings me to my cheat-sheet of guiding principles for working with kids: (1) Don’t sweat the details in the early grades! (2) You are there to put a face to the science. (2) You are there to communicate enthusiasm. (4) You are there to excite curiosity. Every time you feel a caveat welling up inside you, about to surface, SQUASH IT! Every time you feel yourself mulling over the underlying complexities and fine points, push them back down and think about the big idea that you are trying to communicate. In these venues, these details don’t matter and they just derail what should be a big (-ish) picture explanation.

What’s great about sorting is that all it requires is that your audience be able to compare two numbers. That said, it brings me to another guiding principle: (5) Talk to the teachers and the school about what the kids know and don’t know – don’t assume too much and try not to do too much! This can be frustrating for you – but better than being frustrating for them. Give them an “AHA! Moment.” If you do this once, you have done a lot and you’ll be surprised at where and delighted when those “AHA! Moments” are found.

For my little exercise in each grade-level activity I broke up the grades into three groups. All the students were given numbered index cards. After a little bit of “getting to know you”, the topic of sorting was introduced via their experiences with Google – you can’t just take for granted that anyone from a second grader to a fully tech savvy adult would think it obvious that sorting is important. But, even second graders have “Googled” and they can appreciate that after finding potentially relevant websites they need to be sorted so that you see them in order.

From there, the first group acted out the fundamental sorting algorithm of Insertion Sort. We even added up the total number of comparisons, thereby touching on the idea of computational complexity and talked about what order would the cards have to come in so that we had to do the most number of comparisons – they got it! We then talked about that as regards the Google example – what if Google had to sort 1,000,000 websites before it showed you the list?! That could take roughly one trillion comparisons! (How long would that take if it did one a second or even 100 a second?). This gets across the idea that not only must you be clear when thinking up an algorithm, but you also need to think about the efficiency of an algorithm.

The remaining two larger groups acted out the classic efficient sorting algorithm of QuickSort (every kid wanted to be the “pivot”!) and finally Merge Sort. In both of these cases we didn’t quite get to the end – you need to stay aware of attention spans! Once again, don’t let the perfect get in the way of the good. I later did these again separately for two fifth grade classes (my own fifth grader demanded it!) And we didn’t just talk about algorithms, we also talked about being a person who thinks them up, or a person who figures out how to get a computer to execute them, or someone who uses them.

The enthusiasm on the part of the students was extraordinarily rewarding. The vibe is much different from teaching at the College level. Could you imagine a group of college students chanting “Al-go-ri-thm!”? Did I reach them? I think so. I hope so. I sure did have fun and in truth, it doesn’t have to be computer science. It could be any subject or great idea. I think it’s important to introduce kids to the world of ideas early. They can handle it!! Just meet them at their own level – or maybe a smidgen above to give them something to reach for. In this instance, I know I reached some of them. I later ran into one child with his parent. He came up to me and said, “you came into our school today and talked about computers!” I said, “That’s right. Did you like it? What did you learn?” He said quietly, “Computers are dumb, but people are smart and can get computers to do what they want them to.” I asked him what doing that is called. “An al-go-ri-thm,” he responded and then smiled. Honestly, teaching doesn’t get any better than that.

This post was published on the now-closed HuffPost Contributor platform. Contributors control their own work and posted freely to our site. If you need to flag this entry as abusive, send us an email.
CONVERSATIONS