How We Teach Programming, and Where We're Going Wrong

Fri 5 Feb 2016 Gregory J Stein

On the heels of President Obama's recent pledge to increase funding for computer science education in U.S. schools, I worry about the future of education in the discipline. Without a doubt, teaching students how to program is a must for ensuring that the United States can modernize its workforce and compete on a global scale. However, the ways in which programming is taught in schools often lacks real grounding, and effort needs to be made in order distance general education in computer science from the training given to computer scientists.

The purpose of learning how to code is not to become an expert programmer (just as learning mathematics is not for the express purpose of creating mathematicians), but is to allow people to recognize when a little bit of simple programming can save a huge amount of time and effort. Many introductory and online courses in programming focus too much on abstract skills and not enough on how these skills can be practically applied.

Abstract skills, like algorithms, are assuredly important, but when was the last time any of you coded your own merge-sort.

Gaming on the Rise

Modern approaches to teaching computer science so often involve much of the same sort of activities: learn how to print strings, work with loops, add a bunch of numbers together, etc. While I enjoy tackling these exercises (and have devoted my academic career to doing so), most people don't, further raising the barrier for learning to code.

Enter the gaming industry.

With an increasing number of people looking into programming, many gaming and technology companies recognize that there's an opportunity here to reach more customers. They have created games, like Human Resource Machine, which attempt to make programming more fun, by effectively tricking people into puzzle solving using techniques drawn from computer science.

Human Resource Machine is a game that involves puzzle solving through designing simple programs. As the game progresses, more sophisticated concepts are introduced including loop structures (via jump statements) and storing values in memory. It was designed by game studio 2D Boy, also known for games World of Goo and Little Inferno.

In addition to games which aim to teach programming concepts, there has been increased interest in encouraging young students to create programs to interface with their favorite games. Far and above the most popular game for this purpose is the Microsoft-owned Minecraft. The game, shown in the screenshot below, is about exploring a open-ended, block-like world, collecting resources and then using those resources to build new items and structures. In addition to the game's immense popularity and accessible learning curve, the game's code is relatively easy to modify directly, allowing students to write simple programs and then see the effects of their work in-game. In addition to books devoted to programming-via-Minecraft, summer camps have started to appear that teach these concepts in a more classroom-like setting.

Even at a professional level, Prof. Stefanie Tellex of Brown has introduced a means by which Minecraft can be used as an environment for experimental robotics.

Minecraft, the Microsoft-owned game about building and exploration in a block-like world, has become quite a popular educational tool. Students are encouraged to write code to modify the game so as to illustrate programming concepts in a more visual and interactive way.

Despite the success of this approach, outlets such as these are geared towards those who already recognize the importance of learning to program, and are perhaps not as effective for everyone else. They don't answer the burning question: Why should I learn to program? With computer science becoming a national focus, this responsibility becomes that of our educational system.

An Anecdote

Whenever people ask me why they should learn to program, I tell them this story.

During one of my summers between semesters at college, I found a job working as a paralegal for a few months at a law firm in New York City. At the time, I hadn't quite figured out what it was I hoped to concentrate my studies on, and I knew that I would gain worthwhile contacts and meaningful experience from such a position.

One of the more tedious responsibilities of my job was to extract certain chunks of data from finalized legal documents, parse them, and then collect them into separate documents for the Firm's meticulous records. Often, this sort of data re-formatting was sufficiently quick that no one thought very much about it. However, during busy periods, this procedure would quickly get in the way of more pressing work, and the task would frequently be delegated to the newer employees, i.e. me, who had less on their plate. Over time, dealing with these requests became a relatively large portion of my job.

I suspect that most people, even those who use Microsoft Word and Microsoft Excel at a professional level, are unaware that there is a scripting language (VBA) and programming environment built-in to their software. I, most recently, created a script to convert rudimentary LaTeX code into a plainly formatted Word document.

Eventually, the tedium of my position began to wear on me, so I decided to automate as much of the process as I could using Visual Basic for Applications (VBA), a programming/scripting language which is built into Microsoft office. The code was not particularly sophisticated, consisting mostly of string parsing and formatting routines. My little program saved me and my department tens, if not hundreds, of hours of data entry over the course of my time there. Naturally, the output of my tool was always reviewed by a user for accuracy so that nothing would ever be lost to any bugs in the code; although this prevented the script from completely automating the task, the savings were undeniable. I received a small bonus for my trouble (though not having to manually enter all of that data was it's own reward) and helped to de-stress my colleagues for a short while.

Next Steps

President Obama, like many legislators, recognizes the importance of teaching young students how to program. Here he is at an Hour of Code event, which shows students that they can learn some programming fundamentals in just an hour [source: Wired].

What's the takeaway from my paralegal experience? Is it that everyone at the Firm should have known how to program? Perhaps, though there is a larger point to be made: being able to program can only ever be as important as recognizing when writing code to accomplish a task will be worthwhile. Don't get me wrong: I still think that programming is a fundamental skill, like mathematics and reading/writing, and that President Obama's pledge to incorporate computer science into curricula is certainly a step in the right direction. However, the emphasis needs to be on teaching more practical skills, like recognizing when a task can be made far easier through automation.

I welcome your thoughts/comments below.

Liked this post? Subscribe to our RSS feed!

+ Show Comments From Disqus