Can Keith Code? Lesson 1, Scratching the surface

With the kids on-board for the “Can we learn how to code together?” project, our intrepid reporter rushes head-long into Scratch to explore a world of sprites and scripts.

Credit: Image credit: ITworld/Stephen Sauer

“Can Keith Code?” is a series exploring the journey of a former middle-school programmer-turned-journalist as he re-attempts to learn a programming language, alongside his three children (and, hopefully, beyond). The goal? By the end of the series, Keith will know at least two or three different languages: Scratch, Python and Javascript.

With the kids on-board for the “Can we learn how to code together?” project, we rushed head-long into the Scratch language. The project, which was developed in 2003 at the MIT Media Lab, is designed for 8- to 16-year-olds, as well as their parents. It introduces a bunch of programming concepts and logic in a fun and easy-to-learn manner. It’s free to use, and you can also then sign up for free with a username/password.

This is where our first moment of drama arrived with the kids. They don’t have a lot of experience yet in trying to come up with usernames, especially ones that ask you not to use their real names. My son, of course, wants us to have a username that includes the word “fart”, while my younger daughter just wants a reference to either Elsa or Anna from Frozen. I suggested “TeamShaw” as a username, but my son pointed out that we didn’t want to have our last name involved. In the end, we picked favorite characters from movies, and we ended up with a combination of Woody from Toy Story and Star-Lord from Guardians of the Galaxy.

The Scratch site has a neat video on its home page that shows a bunch of the different projects that its users have created, so I played that for the kids to get them motivated and excited, to see that it was more than just a paint program or animation tool. I think the biggest problem in trying to get the kids started with programming is that they have the 50,000-foot idea (such as “I want to invent a game where you can fight your friends”), but haven’t yet figured out the basic parts just yet.

Fortunately, after the video was done we could jump right into the on-site tutorial, which lets you create a program with the tools and sort of shows you the interface. Scratch uses a series of visual blocks to represent commands, and when you click and drag them into your “Scripts” area, you can connect several blocks together to start creating your program, which is then “acted out” on the interface’s “Stage”. On the stage is where the program’s “Sprites” appear, and each sprite that you create can include multiple scripts running on them, depending on whether you need the end user to perform input (click a flag, click a spot on the stage, etc.). You can also have multiple sprites doing things at the same time, or reacting to each other, etc. Other cool features include the ability to modify the sprites with color (through a simple Paint-like interface), as well as add sounds or photos through the computer’s microphone and webcam. It was this area that the kids really enjoyed -- instead of creating a soundtrack to their initial game with the provided background music, we recorded them singing their own song, which we were able to play in a loop.

After we got through the Scratch tutorial provided on the site, we jumped into the first project in our DK Publishing book, called “Escape the Dragon!”. It’s a simple program where your initial sprite (always a cat, the unofficial mascot of the language) is being chased by a dragon, and the user controls the direction of the cat by moving their mouse around. As you get deeper into the project, you can direct the cat by moving a third Sprite around (in the book, it was a donut).

We decided to go off the board a bit and change the sprites from a dragon chasing a cat to a mouse chasing a Mom. We replaced the donut with a bowl of cheese puffs (closest thing to cheese for our mouse). The flexibility of letting kids choose their own sprite designs or come up with their own is very cool -- it reminds me of several different kid-themed painting and rubber stamping apps on the iPad. The combinations may not make sense to the logic-driven parent, but kids are just fine with a mouse chasing a wizard on the moon, for example.

The instructions on creating the different scripts were explained well within the book, and after about 60-90 minutes we had our finished “game” that we could start playing (basically, the game’s object is to see how long you can run around the screen before the mouse catches you.) At this point it was time for the kids to go to bed.

My oldest daughter (age 8.5) seems to understand the logic within the scripts, but I think for the next project we’re going to switch positions and I’m going to have her doing the click-and-drag portions. For this one, she was reading along in the book and then watching me build the script. My son is more interested in the visual part of the stages, sprites and colors, rather than the logic, such as the “if/then” statements or figuring out how to move. My youngest is just happy to be a part of the team.

I also downloaded the “ScratchJr” app for the iPad, which is even more basic since it’s geared to the 5- to 7-year-old crowd. The app has the same ideas in terms of a stage, Sprites, sounds, colors and backgrounds, but the scripts are created by moving visual icon blocks instead of descriptions via words. It helps that we already knew the basics of Scratch to know what icon we needed to start the program (the Green Flag), but it feels like we can get more complex with Scratch once we get a lot of the basics down.

Next up: more script work and examples with the Scratch language through the book, and we’re going to see if we can build a simple dice-based game (or even figure out if we can duplicate a Rock, Scissors, Paper program).

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon