Nobody Wants to Learn How to Program

I frequently see a problem when people (especially techies) try to teach programming to someone (especially non-techies). Many programming tutorials begin with basic programming principles: variables, loops, data types. This is both an obvious way to teach programming and almost certainly a wrong way to teach programming. It’s wrong because nobody wants to learn how to program.

If you are teaching a class of adults who are paying with their own money for an education, then this is an appropriate and direct way to teach programming. It’s their money. They expect that they’ll have to focus and slug through concepts to come out the other end with programming knowledge. The start-with-variables-loops-data-types approach is fine for this. But most likely they still don’t want to learn how to program.

But for the casually interested or schoolchildren with several activities competing for their attention, programming concepts like variables and loops and data types aren’t interesting in themselves. They don’t want to learn how to program just for the sake of programming. They don’t want to learn about algorithm complexity or implicit casting. They want to make Super Mario or Twitter or Angry Birds. This idea is best summed up in one of Ryan North’s Dinosaur comics (click to enlarge):

Here are my five pieces of advice to people who want to teach programming or create programming tutorials:

1. Kits Are Not Programming

If you make the realization that nobody wants to learn how to program and jump past that trap, there’s a second brick wall on the other extreme you might hit: software creation kits. This is especially notorious with drag-and-drop game creation kits. In trying to make it programming easy to do and abstract away details, these kits end up getting rid of, well, programming. (Although there’s no end to products that claim to let you create applications without any programming at all.)

But people can feel the limitations that these programs have. Many of these kits are good for creating a certain class of applications or certain genre of games, but have a restricted reach because they aren’t flexible enough. We need legos, not playsets.

(I enthusiastically endorse Scratch for use by the pre-teen crowd, especially since typing can be a large barrier to programming for that age group. Scratch rides the kit/programming line very well. GameMaker, RPGMaker, and other kits, not so much.)

2. Toy Examples Are Fine, As Long As They Are Braggable

Almost every programming book and tutorial has examples, but these are usually code snippets to demonstrate a single function or concept. Breaking down learning material to single concepts and providing a simple example. This is an obvious way to teach programming, but nobody wants to learn programming.

The main examples in my book, “Invent Your Own Computer Games with Python” (free to read under Creative Commons at http://inventwithpython.com) present the complete source code to simple games like “Guess the Number” and “Tic Tac Toe”, and then explain how these programs work. A small amount of programming concepts had to be taught at the start and some single-concept examples are given, but the chapter always centers around a complete game.

The first few game programs are all under 50 lines long, but this is fine because they are still complete programs. This isn’t something they can make money off of in an appstore, but the standards for something neat enough to show someone else are much lower. By leading with complete programs and then explaining the programming concepts that go into them, you give the learner a reason to continue learning.

As a result of what code goes into each game program, programming concepts in “Invent with Python” are given in an unorthodox order sometimes. That’s fine. Beginning programmers don’t realize they’re learning concepts in a weird order and don’t care as long as the learning material makes sense. If you are creating tutorials for self-directed learners, they’re going to learn in a non-linear manner anyway.

3. Beginner Programmers Are Plagiarists (So Give Them A Lot To Plagiarize)

I began learning BASIC in the third grade. This might sound impressive to people who think that only the highly intelligent can learn to program computers. The thing is, all of my programs for the next several years were just slightly-modified copies of the same two or three types of programs I had already seen. They were mostly print and if statements with a few random numbers thrown in.

Newbies’ programs bear a lot of resemblance to the programs they’ve already seen because they don’t have enough experience to know how to take an original idea and deconstruct the code needed to make it. So help them along by giving them several different examples. (“Invent with Python” has simple “coin toss” guessing games, games that manipulate strings such as Hangman and Bagels, games that use 2D Cartesian coordinates, and a small encryption program).

It’s okay if they don’t completely understand how a program works after they’ve played with it a little. Very few ideas are completely original. The more material you give your students to plagiarize, the wider the range of derivative works they’ll make from them.

4. My Programs, Let Me Show You Them

One thing that MIT’s Scratch programming environment gets right is that they have a way to share programs that students create built into the software directly. Nobody wants to learn programming, they want to make cool programs. Being able to easily share their programs with a community not only provides an incentive to learn and create, but it also provides a library of examples for other people to look at to inspire their own programs. The Pygame.org website has a sidebar that is constantly updated with people’s submitted games (source included), which supplies that community with hundreds of examples to learn from. I’d say this is a major factor for Pygame’s popularity over Pyglet and other Python game frameworks.

5. Don’t Distract New Programmers with OOP

Enough said. Things you can also toss out for the new programmer syllabus: recursion, regular expressions, MVC, networking, and file I/O. These things can come much, much later after they’ve made a few programs on their own.

If you are teaching programming, remember that nobody gets excited over remembering to put semicolons at the end of a line. Nobody wants to learn programming, they want to learn how to make programs.


UPDATE:

Zed Shaw (author of the great book “Learn Python the Hard Way”) left this comment on Hacker News:

“And no, I’m saying it’s a huge myth that nobody wants to learn the “hard stuff”. They do, you just have to teach it right. After that you just have people who aren’t interested in programming at all and no amount of graphics, games, or cute cartoons is going to make them want to. You can’t force or trick enlightenment on people.

But more importantly, I have evidence to back my beliefs. This article has absolutely no evidence.”

He brings up a good point. Here’s my response:

“Hi Zed, I’m Al, the author of article. I’ll admit the title is hyperbole. There are people who want to learn programming for the sake of programming, just like there are people who like learning math even though they don’t see immediate practical applications.

I teach programming to a tiny class of 10-12 year olds on Saturday mornings, and have taught a couple one-off classes at Stanford’s Splash program to a classes of a dozen students. I’ve found that having an end-goal in mind of what they will create is a much better hook than just explaining what for loops are (or the idiosyncrasies of the languages are, which Python & Ruby are good about keeping to a minimum.)

I don’t think graphics and cute cartoons are needed to make programming engaging either. My book “Invent with Python” has games that use ascii text up until the last few chapters. There’s a pretty low standard for games/programs that are cool enough to show off to other people, but nobody ever shows off code snippets.

I think the best thing about “Learn Python the Hard Way” over a book like O’Reilly’s “Learning Python” is that your book cuts it down to the bare concepts: “Type this. This should appear. This is what is happening.” That’s great compared to most computer books where there are paragraphs upon paragraphs that could be whittled down to a single sentence or cut out entirely. “Learn Python the Hard Way” is barely over 200 pages. That’s much more digestible than some 600 page tome.

I just think that many classes where the students aren’t CS majors or necessarily dedicated to learning programming forget that it’s not just the concepts that people want to learn but what they can make using those concepts. Small games and web apps are great for that. Like in Exercise 22 of your book says, “It’s important when you are doing a boring mindless memorization exercise like this to know why. It helps you focus on a goal and know the purpose of all your efforts.””

57 thoughts on “Nobody Wants to Learn How to Program

  1. Good article. In my extensive experience teaching all ages & types,Logo & Scratch are best for kids & non-technical beginners. Learning any PL can be made easier by using a simple & decent editor, e.g.,the online one used by CodeAcademy. It makes Java syntax,very confusing for beginners, somewhat easier to tolerate. Unfortunately, many editors are harder to learn than the PL.

  2. I’m 18 and maybe I’m a bit old for what this article is talking about. But for me, at first “programming” sounded fun because of the rewards, soon after I learned about software engineering, how programs are built, how complex they can be, and changing even the slightest bit of code could be tons of fun.

    I am now am getting my financial aid set up so that I can get my master’s in SE and create my own startup, sounds original I know…. But both of my parents have their PhDs in psychology, which really contributes to my natural understanding of how peoples’ minds work, so I believe that I can go out in the world and really understand what needs to be done.

    I want to say, in addition, that I’ve found a friend recently, 15 years old, he didn’t know what to go to college for until he asked me how much do computer guys make. Ever since he’s wanted to become a programmer. Which is great, but he doesn’t want to program.
    I’ve asked him what he’s done to learn programming in the last year, nothing. I’ve sent him NUMEROUS resources and programs for him to learn BASIC code to get started, no reply. The only thing he’s into are those simple block iphone app editors, which is not programming. He’s ONLY in it because you can make a good amount of money. But he doesn’t understand that people like Zuckerberg didn’t “write a bit of code” become rich, and party all day. But spent (and still is) 24/7 coding and drinking Gatorade. I find joy in that. Him? Probably not.

  3. Amen. As someone who came into tech with a background in teaching human languages, I agree with every single one of your points. Good pedagogy often means leaving the idealistic rhetoric of your profession at the door and accepting how an audience of non-experts really interacts with the material. Funny how controversial that can be, though.

  4. I also have to agree that learning about loops, variables, data types etc in the beginning is very boring. I had the same problem for the first year of university, it was after my traineeship where I really started programming “real programs” that were bigger projects and offered more functionality that I finally started having fun while programming. But I still think it’s important to start with the basics. Those who really want to program will get past the basics, those who just want to program games quickly won’t stick to programming long enough anyway because they underestimate the work that’s needed to program a game.

  5. I also have to agree that learning about loops, variables, data types etc in the beginning is very boring.but after i graduate in college i realise the important of programing

  6. Al, you are spot on with this post and don’t let anyone say otherwise. Yes, it is a bit of a hyperbole, but even adults get bored with dry theory without obvious practical application (speaking for myself). I just recently found your Invent With Python free PDF book while looking for Pygame information, and I have to tell you, it’s the best I’ve seen so far for introducing someone to Python programming painlessly. From my prior classes and online help, I have found actual interesting code more or less treated like a state secret, especially in computer classes where the honor code requires you not to share code. That’s like learning a new language by reading a dictionary! That’s not how people learn to talk, and it’s not how I have learned to program. Emulation of working programs naturally leads to an inner desire to ‘tweak’ the program, because let’s face it, the whole point of playing with computers is to get them to do what YOU want them to do, not what some other bloke thought was important. But you have to have something to start with, and your technique of teaching that by example is outstanding.

    One other resource that I can recommend to any aspiring Python newbie programmers (or newbie GUI wannabees) is the new Rice University free online Coursera class “Interactive Python”. The instructors have a very similar philosophy to yours, probably because they 1) love having fun and 2) have significant teaching experience. I cannot recommend that video course highly enough when it is next offered. In fact, it is indirectly what lead me to your book.

    Thanks for sharing your expertise, it’s not just 10-12 year olds that you’re helping! ;-)

  7. Hello from Canada. I completely agree with your points. I’m a middle-aged farmer with no programming background, but an urge to know what the fuss is about. The loops, variables, etc. are just so much gobbledygook until I get many exposures to how they are used and how they can be made into useful, cool little programs. I’ve had this experience before, learning french. It was just verbs and vocabulary, i.e. torture, until I rode a bike around France and could use the language to ask for food, a place to sleep, have limited conversations and so on. You can’t learn, at least not well, without interest, so thank you for your terrific book(s). – Rob

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>