Practical Debugging – Scratch@MIT 2016

A couple of weeks age, I ran a ‘Practical Debugging in Scratch’ workshop at the 2016 Scratch@MIT conference in Boston. It was an amazing experience, and great to meet so many other passionate educators from around the world.

debugging.jpg

The workshop briefly introduced debugging (including its history and some terminology), along with some teaching strategies for ensuring that debugging is approached as a part of the programming process.

However, the bulk of the workshop introduced some practical techniques for debugging projects in Scratch, including:

  • Commenting scripts with their intended purpose, as well as commenting blocks (or sets of blocks) for which the effects aren’t immediately obvious. Parts of a script can also be ‘commented out’ by dragging and dropping, facilitating the testing of later parts of a script;
  • Making script output as visible as possible. This can be done by displaying variables on the stage, clicking individual blocks to test their output and using ‘say’ blocks within scripts to give visible feedback;
  • Stepping through scripts can be achieved through the use of ‘wait’ or ‘wait until key pressed’ blocks, slowing down the execution of a complex or fast-moving code;
  • Testing expected and unexpected user input can lead to using input validation to make a script more robust. Input can be validated by using ‘repeat until’ blocks, Boolean operators, or even a list of accepted answers;

validation.png

  • Lists can also be used to log data, which is useful for sequences of data, or multi-part calculations;
  • Custom blocks allow the creation of modular code. It’s much easier to find a bug when a sprite jumps if your project has a custom block called ‘jump’!

One final technique covered was the use of cheats as a testing method. Although children often see cheats as a way of making playing a game easier, they were first introduced to make play testing easier. Before a game is released, the entire game has to be rigorously tested, and cheats make this easier. For example. How can you test the last level of a game without having to repeatedly play previous levels? A good cheat shouldn’t be easily discoverable, or interfere with normal play. Combinations of key presses work well, but children also really enjoy creating tiny 1-pixel sprites that can be clicked to activate a cheat or other ‘Easter egg‘.

Screen Shot 2016-08-19 at 10.26.51.png

The notes from the workshop are available at jumpto.cc/practical-debugging. Sharing techniques with children to spot and fix problems in their Scratch projects themselves will empower them, giving them more ownership of their creations. This is especially important for lifelong learning, at times in the future where there may not be an educator on hand to help them. In fact, many of the strategies covered in this workshop are used in industry by software development teams!

Advertisements

Olympic Gold – Part 2

In Part 1, I showed how to make a 3D perspective sprint game in Scratch.

Screen Shot 2016-07-01 at 13.09.25.png

In this second part, I’ll show how to make a really simple MaKey MaKey running mat to use as input for the game.

To make the running mat you’ll need:

  • A MaKey MaKey
  • 2 pieces of cardboard
  • Some sponges or foam
  • Aluminium foil
  • Glue
  • Scissors

00

First, cut your sponges to create 3 strips down the left. right and middle of one of your pieces of cardboard.

01.JPG

Cut and glue some aluminium foil in the 2 gaps between the sponge strips. These will be the connections for the left and right foot pedals. Make sure that the foil isn’t touching the sponge – or you’ll crete a short circuit.

02.JPG

Cover the second piece of cardboard with aluminium foil. This will make a connection with the foot pedals when stood on.

03.JPG

Attach the left and right pedals to the left and right arrow keys on the MakeyMakey. Connect the large foil-covered piece of cardboard to the Earth connection on the MaKey MaKey.

04.JPG

You can now turn over the top foil-covered cardboard and glue it onto the cardboard with the 2 foot pedals.

The running mat works by having left and right foot pedals that are separated from the Earth connection by rows of sponge. Standing on the sponge quashes it, and connects the pedal to the earth connection, completing the circuit!

Connect your MaKey MaKey to your computer and open the Scratch Olympic Gold project. You can now control the game with your new running mat, standing on the left and right foot pedals as fast as you can to sprint!

Here’s the running mat in action (sorry about the portrait view):