Rik explains: encouraging learners to collaborate in Scratch

Rik Cross is the Interim Head of Content and Curriculum at the Raspberry Pi Foundation. He also runs a Code Club and is a former secondary school teacher. So he has a wealth of knowledge about all things Code Club and Scratch, which he shares with you in our blog series ‘Rik explains’. 

Today I’m going to talk about some of the ways in which you can use Scratch to encourage collaborative programming in your Code Club. I’ll first discuss some general approaches and then give you examples of practical activities to promote collaboration in Scratch.

ghosts

Approaches to collaborative programming

Pair programming

Pair programming is exactly what it sounds like: two learners program together! Usually, one learner takes on the role of ‘driver’ and writes the code, while the other learner is the ‘navigator’ who observes, reflects on, and reviews the code as it’s written. Pairs swap roles regularly, say every ten minutes.

As paired learners need to discuss the code before writing it, they are automatically encouraged to think logically and discuss solutions. They are also less likely to produce bugs, but if they do, discussing with each other will help them to debug their code more easily.

It has been shown that pairing more able and less able learners is of benefit to both: the less able learner sees how a more experienced programmer approaches and solves problems, and the more able one learns how to explain solutions in a clear and understandable way.

It’s also worth noting that this approach works best when learners collaborate on a project about a shared interest. This means that with some forward planning to decide on who to pair up in your Code Club, you will maximise learning.

Remixing

Collaborative coding can also happen remotely in the awesome Scratch online community! Learners can take online Scratch projects and change, personalise, and expand them. This is called ‘remixing’ (and it works with or without a Scratch account).

To remix a project online, simply log in and click the ‘Remix’ button in the top right-hand corner of the Scratch editor to create your own copy. (To remix without a Scratch account, download the project to your computer instead.)

Screen Shot 2018-07-06 at 11.01.02

You can see who is remixing your projects on your main project page:

Screen Shot 2018-07-06 at 11.01.54

One benefit of remixing is that it allows a learner to start with a project containing some more complicated code. For example, they might find a platform game project in which the code to handle player movement has already been written. This allows them to focus on things like designing levels, adding sounds, and creating custom graphics. As they become more experienced, they can look back through the original code to discover how to program the more complex features of the game. Being able to understand and edit existing code is an important skill to learn — professional developers share and re-use code all the time.

There is a great set of community guidelines that learners should read before joining the online Scratch community. One important piece of guidance is: “Be sure to give credit when you remix”. A good way you can teach this is by encouraging your learners to use the ‘Notes’ section of a project page to thank and give credit to others.

Screen Shot 2018-07-06 at 11.03.44

Activities to encourage collaboration in your Code Club

Custom blocks

A perfect time to encourage your learners to work collaboratively is when you’re showing them how to make their own custom blocks. Scratch allows learners to create their own blocks, which they can even pass data into. The example below shows a simple draw square custom block that is used twice to draw two different coloured squares.

Screen Shot 2018-07-06 at 11.04.27

One of the many advantages of custom blocks is that you can use them for decomposition, meaning you can break down a problem into smaller sub-problems and tackle each one separately. In the example, once you’ve created the draw square block, you’ve solved the sub-problem of drawing a square and don’t need to think about the block’s inner workings anymore. Another advantage is that once you’ve defined a custom block, you can use it as many times as needed. This means that if you, for example, want to draw larger squares, you only need to make one change to the block code, even if you’ve already used it to draw lots of squares.

If you’ve never worked with custom blocks before, you can get started by using our Binary hero project.

To highlight the power of decomposition for your learners, you could divide them into two groups. Then you can task one group with specifying the customm blocks needed (meaning the sub-problems to be solved) and creating the main code that pulls everything together. The other group has the task of creating custom blocks to solve the sub-problems. They can test each of the custom blocks separately before adding them into the ‘main’ Scratch project.

Crowd-sourced projects

Another way of encouraging collaboration in Scratch is inspired by the “Add yourself…” projects (such as the excellent Add Yourself to the Race!). These are crowd-sourced Scratch projects for which community members create sprites that are each coded to respond to messages that are broadcast in the main project.

Start this activity by deciding with your learners what the theme and the rules of the project should be. For example, you might like to work on a dance project in which learners can create sprites to have a dance party together. The moves to be broadcast could be:

  • Move left
  • Move right
  • Jump up
  • Crouch down
  • Make some noise

Once you’ve all agreed on the theme and the rules, you, or one of your groups, create the Scratch project with the broadcast commands, where all the sprites will be brought together in the end. For the dance example, I’ve created a project with a list of ‘moves’, with one of the moves being broadcast at random every time the music loop is played. (This will ensure that the dancing stays in time with the music!)

Screen Shot 2018-07-06 at 11.05.38

Learners can then create their own sprites that respond to the broadcast dance moves. For example, here’s a sprite that’s been coded to jump whenever it receives a ‘jump’ message:

Screen Shot 2018-07-06 at 11.07.24

To combine the different sprites, each learner can save their individual sprite and then upload it into the Scratch project containing the code to broadcast commands.

Screen Shot 2018-07-06 at 11.08.03

You can find an example dance collaboration project at rpf.io/dance-collab.

This activity allows learners to collaborate while still working at their own pace and ability level. It also allows them to be creative in how they fulfil the task you’ve given them. Plus, it’s really fun to see all of the sprites together at the end of the activity!

Check out the Code Club projects

Looking to find out more about what running a Code Club looks like? The best place to start is by checking out the Code Club projects, our free, easy-to-follow learning resources you can use to teach young people Scratch, HTML/CSS, Python, and more.

You don’t need any coding experience to run your own Code Club — get started today!

 

Rik explains…Debugging your code

Code Club’s Senior Content and Curriculum Manager, Rik Cross, is not only in charge of creating the amazing projects in our curriculum – he also runs a Code Club in his local school in Leeds. His brain is full of amazing knowledge that we thought we ought to tap into more regularly, so we’ve started a blog series, which we’ve dubbed “Rik explains”. This blog tackles a common issue a lot of volunteers face in Code Clubs: fixing bugs in Scratch…


Something I sometimes see in my own Code Club is children putting up their hand and saying “My code doesn’t work” and sitting back and expecting me to fix it!

image01

Often, it can be a lot of code, developed over a few weeks. As I’ve not written the code myself, initially I don’t know how to fix their code any more than they do. As I’m helping children to fix their code, I try to share my thought process with them, in the hope that I can empower children to fix their own code, especially at times when I may not be on hand to help them.

Here are some practical techniques that can be used to debug Scratch code….

1) Code is usually read many more times than it is written. It is helpful to comment scripts with their intended purpose, as well as commenting blocks (or sets of blocks) for which the effects aren’t immediately obvious.

2) As projects get larger, it can often be frustrating to run an entire script just to check whether the last few newly added blocks work as expected. Groups of blocks can be separated from their containing script and clicked, allowing them to be tested in isolation. They can then be dragged back into the main script once they have been tested.

image03

3) It helps to make script output as visible as possible. Variables can be displayed by checking the tickbox next to the variable name. The variable name will then be displayed on the stage, along with the current value. You can also do the same with some sprite and project properties

image09

‘Say’ blocks can also be used to make code output more visible, and individual blocks can be tested by simply clicking them — they don’t need to be attached to a script in order to be run!

image02

 


4) Slowly 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;

image00

5) Testing expected and unexpected user input can lead to making a script more robust. For example, take a look at the following script:

image08

What would happen if we ran the above code and answered “‘yeah” or “yep”? We could make the script above more robust by allowing for more than one positive answer:

screen-shot-2017-02-13-at-14-43-51

You could even achieve this by using a list of accepted answers:

screen-shot-2017-02-13-at-14-43-57

6) One final technique I want to mention is 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.

image05

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!

Embracing ‘chaos’ in your Code Club

Code Club’s Senior Content and Curriculum Manager, Rik Cross, is not only in charge of creating the amazing projects in our curriculum – he also runs a Code Club in his local school in Leeds. Here he tells us about how to make the most of the high energy and enthusiasm that comes with running a Code Club:


At a recent Code Club meet-up, I was chatting to a volunteer who asked for tips on running a Code Club because they felt that some aspects of their club were, in their words, ‘chaos’.

This got me thinking that, in some ways, my club can be chaos too – and I think that’s a good thing. Obviously there is a need for rules and structure within a club, but children also need an environment in which they feel free to experiment and share ideas.

Here are a few ways in which I’d consider my club ‘chaos’:

Children work on different projects. They are personalising their learning, working on a Halo 002project that interests them, at their own pace. I’ve known children skip projects that don’t interest them, or spend weeks on a project that captures their imagination. Some children may, after completing a handful of projects, decide that they have enough knowledge and skill to build something of their own.

Children move around a lot. They look around at what others are making, getting ideas and inspiration. They often invite others to play (i.e. test) their finished projects, and then make improvements based on feedback they receive. Children get a lot of motivation from seeing others huddled around their computer, playing and enjoying a project they made. For this reason, children often make sure that their project is of high quality before allowing others to play with it.

Robot 004It can sometimes get loud. Children ask each other questions, and move around the room to help each other out. They test each other’s projects, giving verbal feedback, sharing ideas or even just having fun with the things they’ve created. When children are motivated to create things that interest them, I think it’s important that they have time to enjoy the things they’ve made.

Children play games. My club use online Scratch, and so as well as playing each other’s games they do get time to play other Scratch projects online. Obviously it’s important that this doesn’t dominate a club, but I think children learn lots about what’s possible with Scratch – especially when moving past the basics. Posting their own creations online is also a great opportunity for children to get real feedback from the community.

What some volunteers call ‘chaos’ is in fact part of the fun, and part of the learning experience; it is how children show the excitement and enthusiasm they feel when making things with computers. All this differentiates a Code Club from regular computing classes, so I always advise volunteers to embrace it!