Your kid is starting to show an interest in computers, with your delighted and enthusiastic encouragement no doubt, and you want to figure out how to foster that interest into a lifelong mastery of the technology that surrounds them.
It’s an important life lesson in a world of increasingly complicated technological gadgets, many of which we must interact with on a daily basis. Youthful curiosity is natural, and now is the perfect time to take advantage of that curiosity and better prepare your kids for a future in which not only do we rely more heavily on electronic and computers to accomplish our day-to-day tasks, but the underlying technology becomes more obfuscated under layers of pander-to-the-common-denominator interfaces.
As the famed physicist and author Arthur C. Clarke put it, “Any sufficiently advanced technology is indistinguishable from magic.” To your children, (and perhaps even to you) it may seem like our smart phones, tablet computers, and even televisions and home appliances, operate by some magical, unfathomable means. The truth, however, is far for that exciting. Or, perhaps, it is even more exciting, when you realize that not only are these devices powered by very mundane forces, but that it is completely within the means of any person to learn to bend this technology to their will.
The first step to learning this is to show your kids where man meets the machine: the code. To make this appealing for your younger children, let’s break the learning process into a series of learning games, and then solidify your child’s confidence in their own mastery over the machine by helping them to program their very own computer game. For these articles, I will be using the Ruby language, for its simplicity, flexibility, and depth.
So, with no more introduction, let us begin.
Part 1: Machines Are Stupid, or, How I Learned To Stop Worrying And Love The Code
If you can teach your children any one thing about technology, it’s that, for now at least, machines are stupid. They are not thinking in the way that you, or I, or your children are. They’re simply a collection of physical components arranged in such a way to respond to commands. Some machines may seem very clever, but the only real cleverness you’re seeing there is that of the machine’s designers in making the device seem smart.
So, if these machines are just sitting around dumbly waiting for orders from a human, how do you communicate with it? That’s where code comes in.
Programming languages are exactly what they sound like, languages. They provide a means for humans to use familiar words and symbols to give instructions to computers.
And like natural human languages, programming languages have grammatical (in computer programming lingo often referred to syntax) components and rules, are organized into discrete units like sentences, paragraphs, and stories. So, if your children are old enough to read, write, and understand the fundamental elements of grammar, they’re perfectly capable of learning how to program.
The main difference between human and computer languages are primarily in their interpretation. Where an ambiguous statement made to a person, such as, “Go to the store and get some milk,” will generally be understood and correctly interpreted and executed, a computer might have some questions. Which store do you mean? What route should I take? What type of milk should I get?
The computer might end up stealing the milk, unless you had specified elsewhere that when getting something from a store, one must take it to the cashier and purchase it before leaving. The bottom line is that, generally speaking, computers will only do exactly what you tell them to do, which is not always what you mean for them to do.
Getting back to programming, let’s take a loot at a programming “sentence.” Consider the following line of Ruby code:
This is telling the computer “Print ‘Hello’ to the console,’ which it will happily do. But what exactly is going on here? Ask your child to read that line of code, and explain, in their own words, what they think it means.
If they have a hard time understanding it, try explaining it by breaking it into smaller parts.
Here’s what’s going on:
There are two parts to this command, ‘print’ and ‘Hello.’ In grammatical terms, think of print in this case as being the verb phrase in the predicate. It describes the type of action you want the computer to do. In Ruby, the term for this is a method. ‘Hello’ is like the direct object of the sentence. It is the thing upon which the verb directly acts.
Once your child grasps these concepts, try a little game to solidify them.
Have your child come up with simple commands for you to do around the house, and then follow the child’s commands exactly as they are written. See who can come up with the most detailed description of each task, trying not to leave out any steps. If they leave steps out, or are ambiguous in their instructions, point out the mistakes and ask them to think of ways to be more specific. This will start getting them to think about problem solving in terms of algorithms, or specifically ordered steps.