Scratch Programming Playground: Learn to Program by Making Cool Games is a brand new offering from No Starch Press.
Never mind all the other programming books for kids, this is the best so far.
It helps that the Scratch Programming environment is so easy to use and allows such creative development, and it also helps that Scratch is likely to be a programming environment for basic robotics in the future. But the book itself is excellent, and works at several levels. A young kid working with an adult, a medium level kid working on their own, or an adult playing on the computer after the kids have gone to bed.
Scratch is in the Logo family of object oriented programming. Indeed, Scratch itself, as a language, is a very short distance from the original object oriented programming, much closer to the source than many professional object oriented language.
It works like this. See the graphic to the right. This is code that controls a “sprite” which in this case is a picture of a ball.
The light brown C-shaped things are control constructs. An outer one called “forever” contains code that will be run from the time the program is started until it is stopped externally. Inside that is an “if” loop that checks to see if the object “paddle” (specified in the blue object) touches the sprite (ball). If that event happens, then the code inside the “if” thingie is executed. In this case, the variable “score” goes up by one, a funny little blerp sound is made, and the ball turns in the opposite direction.
Meanwhile, the paddle has a wadge of code that goes with it as well, which responds to key presses or mouse movements, so that the paddle can be used as part of the bouncing the ball game. And so on.
In the code block on the left, contact between a pirate (a sprite) and a leaf causes the leaf to disappear and the pirate to get a score for making the leaf disappear.
You can imagine the possibilities.
So, imagine the following game. A complex maze is on the screen. The player uses arrow keys, etc., to move a tiny cat around in the maze, working the cat from the beginning to the end. At the end, there is a hole that the cat goes through, and now the cat is in another maze. And so on for several mazes.
Are there objects in the maze the cat must avoid? Or obtain? Will you time how long it takes to get through each level? Will you keep a high score? Will you have two cats, with two people controlling them, each moving in opposite directions through the maze?
The code examples I give above are not from Scratch Programming Playground, but the maze example is. It is one of several projects that the book works you though, as you learn all the various programming concepts in Scratch 2.0. The programs you learn to code produce complicated results and are really spiffy, but the programming itself is easy and the code is not extensive, because Scratch 2.0 is so powerful yet easy to use.
Each example, such as the maze, is fully developed, and then, new versions (like having the second player ability, etc.) added, and by the time you are done with that example, if not sooner, you are already adding things of your own design, from your own imagination.
Scratch 2.0 can be run as a stand along program in windows and on a Mac, but works better on the web, in a browser, on all platforms. Working in that environment, on the browser, has the important advantage of immediate access to a large amount of work done by others, that you can freely borrow from. And, of course, you can show off your own work.
Scratch Programming Playground tells you how to obtain or set up an account on Scratch at MIT, holding your hand effectively but respectfuly through the entire process. The book is also associated with, as per usual for a No Starch book, a web site with the code and other items used in the book. However, I recommend actually hand building most of this code on your own, so you actually learn what you are doing.
It is possible to figure out how to make a hand held game controller work with Scratch programs, but that will depend on the controller you have and the platform. A USB controller and a bit of software from the web that lets you set up the buttons should work.
I would not be surprised if future Internet of Things programming, robotic programming, and other coding you might want to get involved in either uses Scratch or follows this model. The mBot robots can be controlled with a version of Scratch, which produces Arduino code for that robot, and there is now a compiler that allows the general use of scratch for Arduino. Arduino is a basic prototyping machine that can run things, as in “Internet of Things” and that is similar to controllers in general, like the ones in your computer, VCR, thermostat, DVD, car, Mars Rover, etc. (Wait, did I just say “VCR” … whatever.)
A bit of the book giving instruction on a code block to control a tennis ball sprite.[/caption]Anyway, Scratch 2.0 on the web, as per Scratch Programming Playground, gives you, er, your kids, great training in all the programming concepts, and with it you basically controls sprites (objects) on a screen. But the same language is already adapted to control a common form of robot (mBot) and has been adapted to program a widely used controller. So, with Scratch Programming Playground, a little practice and nine dollars worth of hardware, you can take over the world! Or, at least, a good portion of the Tri State Area.
When I do my “Science oriented holiday gift guide” (SOHGG) in a few weeks, this book is going to be on it. Al Sweigart, author, has really nailed a kids oriented programming book better than I’ve seen done before, and I’ve seen them all.