Monday, 2 March 2009

Review of Hello World - Computer Programming for Kids and Other Beginners

My generation were among the first children to learn programming. Thanks to the BBC Microcomputer (in my part of the world), kids were provided with a computer and a manual that taught computer programming in both BASIC and Logo. The local library had a complete set of Usborne books that covered everything from arcade games, to fantasy adventures (the old-school text only type, that is), to assembly language programming and sorting algorithms. And these were for children.

So what was it about programming on the BBC (or ZX Spectrum or Commodore 64) that drew kids in? For me it was all about graphics. Drawing circles could only be done dot by dot and led easily to drawing ellipses, and then to hyperboloids of revolution (think cooling towers) whose top you could twist. I read Chaos by James Gleick, couldn't believe the simplicity of generating the Mandelbrot fractal, and lifted my jaw off the floor the first time my BBC drew the little Mandelbeetle (I'm not the only one - see also PMR). I did some astronomy at school and plotted the night sky for different months of the year. And so on.

Since then we've seen the rise of the PC and Windows, which in fairness had QBasic for quite some time (I am a Nibbles master). However, as David Brin pointed out ("Why Johnny can't code", 2006) today there's no easy way for kids to get hooked on programming. Even my favourite language, Python, is lacking here. Out of the box the only usable graphics library for kids is the turtle module, an implementation of LOGO:
C:\Documents and Settings\oboyle> python
Python 2.6.1 (r261:67517, Dec 4 2008, ...
Type "help", "copyright", "credits" ...
>>> from turtle import *
>>> for i in range(10):
... for j in range(5):
... forward(100)
... left(360/5)
... left(360/10)
...
>>>
It seems to work quite well, although the documentation is aimed at computer science majors rather than teachers (never mind kids). Also, the demo files are only available in the source distribution (you can get them from SVN here).

While Logo might be quite good for introducing the basics of programming languages, its graphics capabilities are limited. pygame is really the way to go. This is one of the big third-party Python extensions that incorporates support for sound, graphics and input devices. As the name implies it has everything necessary to write a decent computer game (see for example, the list of pygame arcade games). The downside is that this library makes no effort to cater for kids.

Enter a recent publication from Manning, "Hello World! - Computer programming for kids and other beginners" by Warren and Carter Sande. Written with 12 year old kids in mind, the preface makes it clear that the authors (one a 12-year old kid himself) know their target audience well:
"For kids especially, one of the most fun parts of using a computer is playing games, with graphics and sound. We’re going to learn how to make our own games and do lots of things with graphics and sound as we go along. Here are pictures of some of the programs we’ll be making:"
(Figure published with permission from Manning Publications)

Lunar lander! Slalom racing! The Sandes have reinvented the Usborne books for the YouTellyTub generation, and then some. Assuming no previous programming knowledge (a reasonable assumption when you're 12), the book teaches Python programming with the goal of writing computer games. The initial chapters cover the basics from variables, through maths, "if" statements and loops. But there's also already the fun stuff like getting input and simple graphical dialogs, and in case attention is waning Chapter 10 (of 24) has the complete listing for a Skiing game. As the book says:"One of the great traditions of learning to program is typing in code you don’t understand. Really!"

After introducing lists, functions, objects and modules, pygame enters the picture in Chapter 16 which covers drawing, images and animation. The following chapters cover sprites and collision detection, events and sound. The final chapters return to useful Python modules such as handling strings, file input and output, and using random numbers. All of the code examples are available for download from the book's website, along with a simple installer that contains all of the examples and modules required, along with Python itself.

As you might have guessed, I think this is a great book that fills a real niche - I don't know of any other programming book on the market that targets kids. What's amazing is that it has set its sights so high, and yet manages to meet its goals. I think it would be great to see this book promoted as a way of teaching programming in primary schools. In the meanwhile if you know any 12+ kids interested in computers, give them an opportunity to develop a fascinating hobby and get them this book.

5 comments:

  1. I'll have to look over that book. I am also nostalgic for the day when we eagerly typed BASIC programs in. It was amazing how much we learned.

    I wrote another book I'd love for you to look over some time called "Game Programming - the L Line" It was intended for adults and students who are interested in learning programming through game development and Python. Although it isn't aimed exclusively at children, the book includes a complete game engine which simplifies the process of building a game with Python and pygame tremendously. The library (Game Engine) is available free whether you purchase the book or not.

    I also have free links to a video version of a course I teach using the book. I hope this will be useful to some of your readers.

    http://www.aharrisbooks.net/pythonGame

    My main site is
    http://www.aharrisbooks.net

    ReplyDelete
  2. I'd like to mention a book that also targets this niche. I made "Invent Your Own Computer Games with Python" available online for free under a Creative Commons license.

    http://pythonbook.coffeeghost.net

    Instead of going over language syntax and tedious lists of functions, each chapter offers the complete source code for a new game, and explains the programming concepts from the example. I, too, also fondly remember the days of typing in source code from magazines and books, and it was the best way that taught me programming.

    ReplyDelete
  3. Wow, great comments, and thanks for the links to the books. And for anyone reading this comment, there are further relevant links at the bottom of Al's page.

    It's great to see all this work going on - it's a pity though that it's not so widely known (that is, I was unaware of it previously). The front page of python.org is 100% corporate, and does not at all encourage use by kids. Maybe a python4fun.org is needed?

    ReplyDelete
  4. Excellet Book For Kids and Adults.

    Programming is not for everyone, but for those who are passionate about creating new programs and using their creativity to solve problems, there is nothing like it. A lot of people have this notion that you have got to be young or under a certain age to be able to pick up programming. That couldn't be further from the truth. As long as you are passionate about writing programs and solving problems, the sky's the limit. That's why I love Hello World!

    ReplyDelete
  5. Wow! That reference to the Commodore 64 gave me a flashback to the mid 80's in upstate New York! LOL! I think that was a good thing. thanks for sharing the extra links they were appreciated. All the best for a healthy New Year!

    ReplyDelete