Weep, Beep and Sleep: Code as a Second Language
Learning to code is being proposed by some as an alternative to learning a second language in school. Imagine having the choice when you're signing up for classes: French, English or JavaScript? It’s an interesting concept, but could present problems if you’re, for example, traveling in Spain and order a bottle of fine Rioja with something like "function getwine('2 liter','house') {}"
But - it's actually not so crazy
Research on brain activity conducted with magnetic resonance imaging (MRI) may support a connection between foreign and computer languages. Scientists stuck a person in an MRI scanner, then asked them to perform a task. As the task is performed, scientists observe what parts of the subject's brain uses more oxygen, which identifies the parts of the brain is being used for the task.
This research suggests that our brains respond to computer programming in the same way as performing music, verbal creativity, problem solving, memorizing, repeating actions, deduction or rhyming.
Rhyming words like
“weep”, “beep”, and “sleep”
light up your brain the same way as
"while (x > 1) { result = result * x; x--; }"
More exciting, there is research to support the idea that exercising your brain is similar to exercising your muscles. Programming and speaking light up the same part of your brain, so it is possible that programming improves your speech. Given that, it’s quite possible that programming can help you develop other skills.
To illustrate, let me introduce you to a cast of characters. Each of these have well-known skills that use parts of the brain very similar to programmers.
Marcel Marceau: Mime
You’ve certainly played charades with friends–pick out the title of a movie, then without words, use gestures until your friends guess what it is. This is pantomime, an art form made famous by Marcel Marceau–and using gestures lights up your brain just like def handgesture(dothis): {print ("glass wall")}.
We all gesture with our hands to communicate; some people can’t communicate without gesturing. When you motion with your hands, you are performing an incredibly complex interpretation of thought into action. You are abstracting a concept – which is exactly what you are doing when you write a computer program. Computer programming is simply a way to communicate logic.
We all assume verbal language is the most immediate and best way to share ideas, but gestures and body language can dramatically color our meanings. Programming and gestures apparently come from the same place in our brains. Perhaps one day, we’ll program computers with gestures rather than words. Um…wait…isn’t that Scratch?
Sherlock Holmes: Detective
Sherlock Holmes was a master of deduction, a skill that shares brain space with programming. Deduction is reaching a conclusion from a set of facts, ignoring conclusions that don’t fit those facts. Sherlock Holmes (a fictional character) explained his approach; “It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth.”
Programming, or more importantly, computational thinking, requires careful analysis of available data. This is the essence of Data Science, which leans heavily on coding skills (note: Be sure to review Barton Poulson’s Techniques and Concepts of Big Data for more on how coding, statistics and domain knowledge are required to be a Data Scientist.)
Research on deductive portions of the brain are filled with if X then Y logic statements, references to X or Y as well as X and Y and not X. Research on programming and it’s effect on the brain is filled with statements such as if (num1 > num2 && num1 > num3) System.out.println(num1). Most computer logic is deductive, so it shouldn’t be any surprise these two independent studies made identical conclusions.
Want to improve your grasp of logic? You can’t do better than learning a programming language – any programming language.
Béla Bartók: Musician
According to our brains and MRI research, playing music and programming computers are the same thing. In fact, just thinking about playing music is the same as programming. These activities each activate a portion of the brain known as Brodmann’s area 40, located slightly above your ear.
This was discovered when scientists asked twelve musicians to learn Béla Bartók’s Mikrokosmos, then play it while inside of an MRI machine. Ten years later, scientists asked seventeen programmers to read code while inside of an MRI machine. Surprisingly, the MRI results were similar in many ways – especially in Brodmann’s area 40.
Bartók might have enjoyed meeting Alan Turing, father of the digital computer, as both of them would have been surprised to discover how their brains were similar.
Édouard Lucas: Mathematician
Lucas invented the famous Tower of Hanoi puzzle, which has three posts and a number of different sized disks. Starting with the disks conically stacked on one post, the goal is to move them one at a time to another post. It’s a study in problem solving and mathematics. Nobody is surprised it uses Brodmann’s area 40.
Problem solving is a daily task. Every daily activity, from taking out the garbage to writing an email requires some degree of problem solving. What is the best way to get to work? When should I go to lunch? How should I calculate the average sales volume for my division? What is the cheapest brand of coffee?
In a sense, programming is a subset of our day-to-day problem solving activities. Reading (int i = 1; i < num2; i++) { result = result * num1;} generates the same brain activity as programming a universal remote.
William Shakespeare
When you were in school, you studied math in one classroom. Then you picked up your books and moved to another classroom for history. Then another to study literature. By the time you were reading Romeo and Juliet you were a long ways from math, certainly from programming. When Shakespeare wrote this line…
Did my heart love till now, forswear it sight,
For I ne’er saw true beauty till this night.
…he had no idea what a computer was, much less how to program one.
Surprise – rhyming and computer programming are apparently the same thing to your brain. When you read those two lines, your area 40 was lighting up with increased oxygen consumption. You might as well have been reading these “rhyming” lines of code.
if (index1 != -1)
System.out.println("Substring is contained: " + key1);
else
System.out.println("Substring is not contained: " + key1);
Scientists mapped these two activities and found they activate our brains in much the same way. Incidentally, poetry and music show the same correlation of activities.
Code as a New Literacy
Suggesting that code can be a replacement for a foreign language is an interesting concept, and there is indeed some research that might support this plan.
But there is a wide range of research that indicates learning to code will help you learn other topics and skills. Programming languages are designed to express complex topics in succinct form, a goal similar to writing poetry, presenting in the corporate boardroom, finding the quickest route to work, or deciding between brands of coffee.
Even if your intent isn’t to write the next great app or game, starting along that path might get you closer to another goal you have in mind.
engineers do not cry...