How to Learn a new Programming Language with Students

Over the last half century, technology and electronics have become more and more complex and what they are capable of doing is simply phenomenal. Yet, for many students of science, the most instruction they receive in Electronics is the lighting of a light bulb or the turning of the motor. It is weird to me that we place electronics at the back of textbooks and curriculum preventing most educators from ever getting to it.

This is an incredible nexus in our history. The technology is amazing, but equally amazing is that the tools to create technology is within your students reach. Never before have their been so many free and relatively easy ways to learn a Programming Language (examples: Python, Google App Inventor, and Processing). Even the hardware is becoming cheaper with the Arduino, OLPC, and Makerbot. The point is that your students can create far more than ever before, and much of it with tools freely or cheaply attainable.

The question is how does one learn a programming language? I have had many discussions with our Spanish Teacher/Linguist on campus and it is clear to me that learning a programming language has some characteristics of learning a spoken language and many differences.

The essentials of learning a programming language
  • Motivation: The students must have an interesting goal or project. This process often requires high level abstract thinking and if they are not into it they will simply shut down. I often will have a demonstration or example of what we are going to do, or an interesting question that is best solved by a program. One example of this is how do you add up the numbers from 1-1000? (Yes I know of the Gauss method, but they often do not)
  • Access to resources. This means online videos, web based tutorials, forums, etc.
The combination of motivation + tutorials is what makes it possible to learn anything. If you have one without the other you are either going to drag them kicking and screaming or get wildly frustrated.

Developing Algorithms
Languages come and go but good algorithms last forever. I would rather they learn to transform a concept into an algorithm than become experts in any particular language. The way I frame this is by presenting a problem (e.g. generate Fibonacci numbers, primes, add two fractions with dissimilar denominators, etc) then asking them to explain it as if it were to a 3rd grader. 

This helps them break down the steps into very specific instructions. I will sometimes play the role of the child who misunderstands a seemingly simple command so they can refine it. Some might suggest using Pseudocode, I simply write it in English shorthand to make it as understandable as possible to the neophytes.

The trick is then helping them translate that to the language. I would not start with the above examples. First start with the Hello World exercises until they are able to get more complex and handle control structures (e.g. if-then-else statements) and looping.

Learning Syntax
Most often in programming languages and spoken languages, the difficulty is not in knowing what to say, but how to say it. When my students are learning a language, I will create or use one of the handy reference sheets found by Googling _________ reference sheet (fill in name of language). The Processing Language has a great reference sheet. Just make sure you adapt it to their needs so they are not overwhelmed. Here is one I made for Python Turtle.

If you really want to get programming with your students, the quickest way to get off and running is to go to the bookstore or go on Amazon and check out a book on programming that suits your needs. Don't be put off by the "dummies guides", I cannot tell you how much I have learned from them and they sit proudly on my bookshelf next to the other more technical books I was able to read afterwards.

Check out the exercises at the back of each chapter and feel free to use these in the classroom, like playing a musical instrument or writing in a journal, these exercises will challenge their minds and stretch their brains. You are doing a service to us all by helping spark an interest and I thank you!

Subscribe to BrokenAirplane!