Introduction to Programming

February 9, 2009

A co-worker, who had a background in project management, decided to learn how to program. She took programming classes at a local college and soon got stuck. She was several months into the class by the time she asked me for help, and by then they had her doing non-trivial Java programs.

In this assignment she was stuck for two reasons. The first is that the program required math, and she had decided long ago that she was terrible at math. This was integer addition and multiplication, mind you, but the very sight of either symbol shut her brain down.

The second was that she was missing basic concepts that the teacher had skipped over or not taught properly. For example, she didn’t realize that when you have two consecutive lines of code in an imperative language, the first is run before the second. That sort of thing. She was treating the program like an unsorted set of math-tainted noise.

This inspired me to write my introduction to programming. It tries to include core concepts, like how to “play computer” to figure out what a program is doing. It also avoids math in favor of string-based examples.

The discussion of arrays describes associative arrays first, with strings as keys. Only as an afterthought does it discuss index-based arrays, which are really only popular because they’re efficient. That’s not something a beginning programmer cares about.

One thing it does extensively is to motivate each new concept by showing what the code would look like without it. The chapter on loops, for example, tediously shows how to write an unrolled list of “if” statements. It’s a relief when loops are introduced and dozens of lines collapse to five.

I use a Python-like language for all example code. When discussing syntax I show a few other imperative languages to demonstrate the difference between a concept (like a conditional) and its expression. And it uses astrology as a recurring example, providing rich opportunities for ridicule.

Because it was written as a reaction to her experience, it fixes the problems she had, but not necessarily those that other beginning programmers have. I’d love to do user testing with it to see what others struggle with.