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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s