Code like a pro: Scratch for future software developers – long read and free online course

Scratch coding example

The ability to create, evaluate and improve the inner workings of software at a range of levels of detail is becoming an increasingly valuable skill in the 21st-century workplace. But are we teaching children to code in a way that supports this? 

London CLC teaching and learning consultant Rowan Roberts has consulted software industry professionals to come up with a range of practices that can turn a good Scratch programmer into a great one – and she’s turned it all into a brilliant free online short course for Tech Pathways London.

Here we’re offering a flavour of it.  It’s in seven parts – read the first couple here, get a taste of parts two to seven and head over to Tech Pathways to enjoy the rest.

Introduction: What makes high quality code? 

What makes high quality code? It’s a difficult question, and one that even industry professionals often struggle to answer. When learning to program, particularly informal environments, most of us learn that there are many ways to solve a problem and that, as long as your solution achieves the desired outcome, it’s as valuable as the next person’s. But is this really true? 

In the tech industry the vast majority of developers are not working in isolation on discrete problems, but as part of a wider creative team made up of people with different roles, skills and knowledge. They need to be able to understand their part in this process, developing effective means of communicating ideas. They need to create solutions that can be adapted, improved or grown as problems change.

All this might sound like high level stuff, but working in this way would be easier for all of us if we picked up better habits earlier on in our programming careers. Here are some suggestions for practices we can teach children to use when they are programming with visual programming languages like Scratch to support them when they enter the world of text-based coding and eventually, for some of them, the software industry.

1. Make your code efficient and adaptable

Let’s say you want to program a Scratch sprite to count to 10. What would be the first thing you’d do? Maybe you’d simply make a list of blocks, each of which gets it to speak a different number:

You can test this script in this project by pressing the green flag and listening to Robot 1.

As you can see, it solves the problem perfectly well. But is it the best solution?

One way to improve the code would be to make it more efficient. Robot 1 uses ten different “Speak” blocks to count. This is not a very efficient piece of code, since although the blocks aren’t identical the instructions are pretty repetitive. Perhaps we could use a repeat block? But we can’t just repeat the same instruction, as our robot needs to say a different number each time it speaks.

This means we need a variable. In programming, a variable is like a label or name which can act as a number in your program, except that the value of this number can change. When you count you can think of the number you say each time you speak as a variable. Each time you speak it gets one bigger. Other common examples of variables are scores, health or timers in games.

In Scratch there is a “Variables” section in the block library. Here you can make your own variable and call it whatever you like; I did this for Robot 2 and called my variable ‘currentnumber’. This script I used is below:

As you can see it’s much more compact, and uses far fewer blocks than the previous script. And as long as the problem is limited to counting in ones it’s perfectly serviceable. If you needed to adjust it so that it only counted to five, or went all the way to 100, you could easily just change the repeat number. 

But what if you wanted it to count up in 10s insteads of ones? Or what if you wanted to use the script to recite the 7 times tables? 

In the software industry developers are constantly implementing ideas with half an eye on how they might need to change in the future. At the moment the script above can be adapted to, for example, recite the 9 times tables, but in order to do so it would be necessary to change both the increment that the variable changes by (‘change currentnumber by_’), and the starting number (‘set currentnumber to_”), to 9. These changes might seem small, but when a piece of code is just one part of a much more complicated project, the time taken to complete them adds up and creates more opportunities for human error.

For this reason, Robot 3 invites you to build your own version of this script. This time, though, the robot should ask the user which times table they’d like to hear, then recite it. When you run an “Ask” command in Scratch and enter an answer, whatever you type is stored as a variable in the small blue “Answer” block. This answer can then be used in your code; so if your answer is 7, you can make the robot count in 7s. But if you answer is different next time you answer the question your robot can tell you a different times table. Try building the script this yourself or use the example below to guide you, by clicking “See inside”, choosing Robot 3 and defining “COUNT(3)”.

This solution achieved something slightly different to the original script, but if you answer “1” the counting part looks exactly the same. It is, however, a much more efficient and adaptable piece of code, giving it the potential to be far more useful.

Enjoyed the first part of the course? Here’s a favour of the rest:

2. Make use of methods and procedures: use ‘More Blocks’

If you’re collaborating on any piece of work with a colleague, it’s important that they can read and understand it. This applies just as much to code as it would to a natural language, but a common habit among the keenest of young Scratchers is to relish building the longest and most logically complex scripts they can manage. While it can be fun to challenge ourselves in this way it can make it near impossible to explain how our code works to someone else, and can even mean that, if we haven’t seen it in a while, we can forget how it works. Not to mention the fact that if something in our code isn’t working properly it’s a lot harder to fix.

Go to Tech Pathways London to see more examples and read the rest of this lesson.

3. Test your projects thoroughly

You might not necessarily think of testing as being part of the process of actually coding, but it’s pretty fundamental at any level, and particularly so in the software industry.

Let’s take an example; can you test this project? Start by clicking “See inside”. What do you think will happen when you run the code? Test it out by clicking the green flag. Does it do what you expected?

If it does… you probably haven’t tested it properly! To test this program fully you need to know what happens when you get the answers wrong as well as right. 

Go to Tech Pathways London to see more examples and read the rest of this lesson.

4. Organise your code

As we saw in the last activity, it can be really confusing when the assets (sprites, costume, sounds etc) in your project are not named in a way that describes what they do or makes them easy to identify. The Scratch team have actually made this easier in Scratch 3 by automatically naming any new Sprite something that relates to its appearance if you choose it from the costume library, but if you draw your own you’ll still find it automatically named “Sprite1”, “Sprite2” etc. 

Go to Tech Pathways London to see more examples and read the rest of this lesson.

5. Use the comment function

Many of the suggestions I’ve made so far have been to do with making code as easy as possible to understand. But there’s an even more straightforward way to achieve this; simply explaining it. 

By right-clicking on any block in your Scratch script area you can attach a comment to it. This can be useful for all sorts of reasons. As a teacher it can be a way to ask your pupils to demonstrate understanding by annotating their code. You can sometimes use it to deliver instructions within a project like this one, which talks you through the process of creating a Maya calendar. You can also use comments to provide further explanation, as in this Egyptian hieroglyphs project. This can be useful for differentiating activities or supporting independent work. 

Go to Tech Pathways London to see more examples and read the rest of this lesson.

6. Conclusion and next steps

I have focused here on defining quality in code, but it’s also helpful to be aware of some of the pitfalls of poor quality code, known in the industry as “code smell”. Quality for blocks has some great explanations of what code smell is, what it looks like in Scratch, and how you and your pupils can avoid it.

I hope some of the example projects used above might give you some ideas for activities you could use with children, but as well as considering what we teach students it’s also important to think about how we are teaching it. 

For evidence-informed ideas on how to structure programming activities I highly recommend anything published by KCL computer science education department, and in particular an approach called PRIMM. It’s a way of structuring coding activities by moving through five steps: predict, run, investigate, modify, make. Using this basic structure you can often create a really engaging activity simply by finding a progression-appropriate example project on the Scratch website, or making one yourself. 

You are also welcome to browse my own Scratch page which contains lots of the projects I’ve used with pupils over the years, the more recent of which tend to include instructions or notes to help support their use with pupils. If you give any of them a try I’d love to hear your feedback in the comments. 

  • Sign up to our weekly newsletter to get edtech news and views, free resources and reviews direct to your inbox every Thursday lunchtime – including a weekly ‘give it a try’ app or tool recommendation.

Join our
mailing list

Sign up for the London CLC newsletter and get the best connected learning news and views in your inbox every week.

Does your school need a sustained programme in the use of digital technology to underpin your whole school aims and plans?

Our support package covers the following:

Professional learning

Teacher professional development which puts digital at the heart of teaching and learning

Pupil workshops

Engaging, practical workshops for your class, in your school, at our Clapham centre online

Creative technology projects

Engaging, immersive educational experiences with corporate and cultural partners

Consultancy & advice

Get tailored support from our expert team of teachers and technologists

Technology loans

Kit for every classroom

Book a call
with James

Upcoming CPD

Summer primary school computing conference
Summer primary school computing conference

This event will build upon the Autumn computing conference by inviting subject leaders to reflect on their year in the role, sharing their successes and challenges. It will also introduce new ideas, tools and approaches through talks and practical activities led by members of the CLC team, with opportunities for attendees to share their own expertise and experience. Over the course of the conference activities will touch on the three main areas of the computing curriculum: computer science, digital literacy and information technology. We will also feature advice and examples illustrating the use of technology to support blended learning.

14/06/22,
09:15
- 15:30
EYFS, KS1, KS2
Computing subject leaders, Teachers...
Creative Arts, Digital and children – CLC meets More Than Robots online
Creative Arts, Digital and children - CLC meets More Than Robots online

Combining forces for the first time, the Connected Learning Centre and More Than Robots have created a session for teachers, youth organisations, researchers and policymakers interested in the digital provision of creative arts for primary aged pupils.

Presentations

The Play Observatory - Prof. John Potter

“In their own words”: Westminster Abbey & CLC digital projects - Sian Shaw

Building (and maintaining) a city-wide primary arts curriculum to raise attainment - Kate Fellows

More to be added soon

This interactive and inclusive meet up will include inspiring examples of how technology can be used to support learning in music, visual art and drama in person and online at home drawing on our experiences as Tate Exchange associates and our partnership work with a range of cultural institutions.

This informal event is an opportunity to discuss real examples of what does/doesn’t work, meet colleagues from other sectors working on similar challenges and share useful research, news or updates

The morning will include case study presentations (details below) followed by a Q&A. There will also be an opportunity for a rapid sharing round for launches, project updates or requests for help and a short break to avoid zoom brain drain.

24/06/22,
09:30
- 11:30
KS1, KS2
Subject leaders, Teachers...

Upcoming Special projects

The News Project
25/11/21,
09:30
- 14:25
KS2

Special project in collaboration with First News Education

For a third year, building on two successful previous projects, we are once again partnering with the children’s newspaper First News, fellow member of the national Making Sense of Media and News Literacy networks. This special project with a literacy, PSHE and citizenship, as well as computing focus, highlights our specialist interest in this important aspect of digital and critical literacy.

The News Project will enable participating classes from year 5 to immerse themselves in news and current affairs using First News and the Bett award-winning First News iHUB, which will be provided free of charge during the school-based part of the project over a six week period. Under the guidance of their teacher, pupils will be supported in their development as a community of fully informed news readers. Classes will test their new critical skills and knowledge in the culminating virtual celebration event which will include a news competition and team-based critical literacy and editorial activities. After the event, schools will be able to use the resources from the day in their school.

The project will launch with an introductory CPD session for teachers to set the context, demonstrate resources and to plan for the school-based activities. 

Initial CPD session - Thursday 21st October 4pm-5.00pm. 

Project work undertaken in school - October and November.

Special event - Thursday 25th November 9.30am-2.45pm.

The Garden Museum
21/02/22,
-
KS1

The CLC is once again partnering with the Garden Museum to offer a partnership project for KS1 pupils (primarily suited to Yr2). Located next to Lambeth Palace on the bank of the Thames, the museum has an inspiring collection that provides the ideal stimulus for young learners to explore the world around them.

Pupils will use technology alongside the museum’s collection to explore the wonderful world of seeds.

  • How are they planted?
  • How do they spread?
  • What is inside them?

 The Garden Museum has a large collection of seeds and tools that pupils will engage with.

These half-day sessions will take place at the Garden Museum.

There is a limited number of dates available, so please book early to avoid disappointment.

This site uses cookies to provide you with a great user experience. By visiting theclc.co.uk, you accept our use of cookies.