Scratch is a computer programming language that is designed for use by children to learn programming, but that is also serving as a paradigm for STEM programming more broadly, and I suspect, for IOT programming of the future. Programs are written in scratch by assembling shapes that represent programming structures or objects.
For example, look at the code block to the right. This is an object that is called when the user clicks on the green flag button on the user interface. That green flag is how one starts a program in Scratch. This is hooked, literally, to a “forever” lop. Within the forever loop, execution (of that object) is delayed for a fifth of a second, then an “If” statement is executed. If the object linked to this object (such as a sprite that might be able to move around on the screen) has come into contact with something green, a chomp sound is made.
The Scratch interface is normally accessed on a web page, and in that context, every single Scratch programmer (that uses the basic interface) has access to every bit of code developed and saved by every other programmer. Or, you can run it on your own computer.
You will see scratch like coding in Lego projects, in association with various robot kits, and I suspect over time, with Internet of Things objects. The coding is so straight forward that even Mikey can do it.
The book Make Your Own Scratch Games! by Anna Anthropy, produced by No Starch Press, brings an elementary school or middle school age kid, or an adult who just wants to screw around, through the process of developing three significant game projects and countless elements that users can use for a number, approaching infinity, of different games.
As is usual for No Starch books, the source code is available, but more importantly, among the on line resources are certain graphics and sound files and such used in the game making.
This is a great book for STEM oriented kids, and Scratch is a great Age of Covid activity.
You will recall that Scratch is a programming language that uses drag and drop elements to construct a program.
Individual objecgts, including “sprites” that can move around on the screen, as well as static graphic elements, sounds, etc. get their own code, and this code can be set up to start under various conditions, such as when something touches something, or the user hits a certain key, etc.
This allows for the development of very simple but fun programs, and vey complicated ones as well.
Scratch is normally implemented on an MIT web page, though it can be installed on a computer for local use. Increasingly, specialized versions of Scratch are being used for robotics. I have predicted that Scratch will for the basis of the programming language that will give normal humans access to the Internet of Things.
The image on the right is a segment of code for an implementation of Pac-Man on Scratch.
This programming code applies to a sprite that looks like the yellow Pac-Man thingie. The entire block runs when a certain (“start”) signal is received, causing the sprite to point in a certain direction and go to a certain location, to start the game.
The next block is repeated “forever” (not really, but until the program is terminated or the loop exited on purpose).
Then the various “if” blocks determine what happens. If Pac-Man’s red part (a little dot out in front of itself) touches anything black, which basically means clear runway to move along, then it moves forward. Then, a series of if blocks pick up signals form the game player’s arrow keys, causing Pac-Man to change direction. The controls basic movement of the Pac-Man sprite around the board.
Elsewhere in the code, the Pac-Man eating monsters are controlled, and one of those uses the code shown here on the right. Once the game starts, this monster (“Pinky”) moves to a starting point, then for the entire game glides in the direction of Pac-Man until it is killed.
That gives you an idea. For more of that, and information about the book I recommend you use to learn Scratch, I mean, give to your kid to learn scratch, go here.
The cards come in sets that go together meaningfully, and they are color coded. For example, there is a set of “Let’s Dance Cards.” This includes coding examples addressing sequencing, music, taking turns, leaving a trail, etc.
The front of each card gives a visual indication of what the result is going to look like, and the back has the code. This is typically further divided (on the back) in to three parts: Get ready (what you need to have, know, etc.), the code itself (like the code blocks shown above, but generally very little bits at a time), and a “try it” prompt or a helpful tip of some kind.
There are sections or racing, hide and seek, story telling, and other projects.
At first I was wondering why they don’t just make this into a book, but then I remembered that kids like to play with things that are explicitly not books. Also, the cards to not have to stay together or in order. Indeed, you can take cards from different project groups and put them together to create new programming projects, to some extent.
I just received two books that I will be reviewing in more detail later, but wanted to let you know about now.
Coding Projects in Scratch: A step by step guide by DK Publishers is a new scratch coding book. I got a copy a couple of days ago and have been going through it, and found it to be excellent. I’ll be including it in my Science Oriented Holiday Shopping Guide for Kids Stuff, which I’ll have out soon, but I wanted to give you a heads up first. From the publishers:
Using fun graphics and easy-to-follow instructions, Coding Projects in Scratch is a straightforward, visual guide that shows young learners how to build their own computer projects using Scratch, a popular free programming language.
Kids can animate their favorite characters, build games to play with friends, create silly sound effects, and more with Coding Projects in Scratch. All they need is a desktop or laptop with Adobe 10.2 or later, and an internet connection to download Scratch 2.0. Coding can be done without download on https://scratch.mit.edu.
Step-by-step instructions teach essential coding basics and outline 18 fun and exciting projects, including a personalized birthday card; a “tunnel of doom” multiplayer game; a dinosaur dance party animation with flashing lights, music, and dance moves—and much more.
The simple, logical steps in Coding Projects in Scratch are fully illustrated with fun pixel art and build on the basics of coding, so that kids can have the skills to make whatever kind of project they can dream up.
Also to be featured in the Holiday Shopping guide, this very interesting technology book mainly for young folk. At first I wasn’t sure how much I’d like it, but then, once I started going through it, I couldn’t put it down.
Super Cool Tech is like a coffee table book for nerds. It is designed to look like a laptop (see the picture at the top of the post) and that is how you open it and use it.
See today’s best innovations and imagine tomorrow’s big ideas in Super Cool Tech. This cutting-edge guide explores how incredible new technologies are shaping the modern world and its future, from familiar smartwatches to intelligent, driverless cars.
Packed with more than 250 full-color images, X-rays, thermal imaging, digital artworks, cross-sections, and cutaways, Super Cool Tech reveals the secrets behind the latest gadgets and gizmos, state-of-the-art buildings, and life-changing technologies.
Lift the unique laptop-inspired book cover to see incredible architectural concepts around the world, such as the Hydropolis Underwater Hotel and Resort in Dubai, and the River Gym, a human-powered floating gym in New York City. Discover how a wheelchair adapts to its surroundings and learn how a cutting board can give the nutritional information of the food being prepared on it.
From 3-D-printed cars to robot vacuum cleaners, Super Cool Tech reveals today’s amazing inventions and looks ahead to the future of technology, including hologram traffic lights and the Galactic Suite Hotel in space. Perfect for STEAM education initiatives, Super Cool Tech makes technology easy to understand, following the history of each invention and how they impact our everyday lives, and “How It Works” panels explain the design and function of each item using clear explanations and images.
Designed in DK’s signature style, Super Cool Tech is the ultimate guide to exploring and understanding the latest gadgets and inventions while looking ahead to the future of technology.
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.