Nobody Wants to Learn How to Program

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.

Page 2 of 3 | Previous page | Next page