Saturday, January 22, 2011

How I Learned to Program

Or, Do I Even Know How to Program?


Recently, I was thinking about how to teach programming, and that naturally led to me thinking of how I learned.

A little background. 
I moved to Vancouver, BC (Canada) when I was 5.  My mom was in a Ph.D. program at UBC, and because of this, we had a computer on loan from the university, presumably so she could work on her thesis. I remember her spending a lot of time on it.

Fast forward 2 years.  We had moved to Chicago. We had another computer, I'm not sure what it's official purpose was.  However, I remember my dad connecting to BBSs and downloading zip files for various games (Centipede, Commanche, Pac-Man).  My mom used LaTeX to typeset her papers, and I was amazed at what the various sequences of symbols would lead to being displayed.  I remember trying to read The TeXbook and not really getting how it all worked.
We also had a computer at school, and because my parents couldn't pick me up until 5pm, I would spend the last 2 hours of every day playing BubbleBobble or something on the AppleIIs that were in the school computer lab.  I used to take copies of 3-2-1 Contact and type in the BASIC code from it in order to "load" new games.  I couldn't save any of them, so it was usually about 1.5 hours of typing and a half hour of playing. I'd change some of the numbers in the programs to see what they would do, and sometimes they would change the colors, other times it would just not work.

I remember one of my parents' friends showing me C code at that age, and me not getting it AT ALL.  The idea of immediate execution was too tightly ingrained in my head.

Back to the present.
An entertaining diversion, but how is this relevant? Well, 22 years later, I think I can say that typing in those programs and changing them was probably the start of me learning to program.  I didn't get any formal training in programming until about the 7th grade, when I went to a computer camp and programmed in LOGO, and had it control a LEGO car.

One of my favorite metaphors for programming is to compare it to carpentry.  They're both used to create items, and thing created by them have an esthetic value as well as a functional value.  They are both dependent on tools, and both have a wide variance in individual skill.  They can both be used to create small, personal projects, or giant industrial ("enterprise") constructions.

I learned to program essentially by whittling a block of wood, and then picking up the tools as they were introduced to me to learn how to make bigger and better things.  Is this the only way to learn? Probably not.  There are some extremely talented programmers who learned the "formal" way... picked up a programming class in college and fell in love.

Regardless, the common thread between all the excellent programmers I know is that they are all interested in programming.  They see improving their abilities as an end in and of itself, not just as a means to a better job (or whatever). Without it being a labor of love, I think it's impossible to be a good programmer.  That's not to say that you can't get a job programming (and even get promoted) without loving it; but it's unlikely that your job performance will match the guy who constantly talks about type-discrimintating unions and lock-free algorithms.

I'll leave you with a quote from one of my favorite authors, and leave it as an exercise to the reader to figure out how it relates to teaching programming:

"Quand tu veux construire un bateau, ne commence pas par rassembler du bois, couper des planches et distribuer du travail, mais reveille au sein des hommes le desir de la mer grande et large."
If you want to build a ship, don't drum up the men to gather wood, divide the work and give orders. Instead, teach them to yearn for the vast and endless sea.



2 comments:

  1. I like the programming as carpentry metaphor. Well said.

    ReplyDelete
  2. Indeed. 21st century Jesus, the second coming, will definitely be a programmer.

    ReplyDelete