KS1 Pizza Pickle Activity

advertisement
KS1 Pizza Pickle Activity
An introduction to debugging Scratch programs
Recommended Year Group: Year 1 & 2 (can be adapted for other years)
Activity Duration: 1 hour
Concepts and approaches
Debugging
Programming
Logic
Persevering
Curriculum links
Computing
debug simple programs
use logical reasoning to predict the behaviour of simple programs
Cooking and nutrition (Design and technology)
use the basic principles of a healthy and varied diet to prepare dishes
•
•
•
Introduction
In this activity pupils will be given programs that do not do as expected and will be
asked to fix them. In doing this they are using logical reasoning to predict what will
happen and debug.
Prior knowledge
Pupils should already have an understanding of algorithms and have programmed
simple activities in Scratch. This could be through completing:
Crazy characters or another introduction to algorithms activity
Scratch tinkering
Scratch bot programming UK map (coming soon) or another introduction to programming activity
•
•
•
Pupil objectives
• I can debug a Scratch program.
• I can say what a program will do.
• I can explain what the bug was and how I fixed it.
Resources
•MIT’s Scratch 2.0 or Scratch 1.4. If possible please use Scratch 2.0, as the
purple 2.0 command blocks are much easier to read than the yellow broadcast
commands used in 1.4. (Please refer to this guide on the ways to download or
use our Scratch resources in your school)
Pupil access to Scratch, in pairs, and project Scratch resources – either downloaded from Pizza Pickle.sb2 (2.0) or Pizza Pickle.sb (1.4) or use within the
Scratch 2 online editor from this link: Pizza Pickle Online 2.0
•
KS1 Pizza pickle debugging activity
page 1/12
•Whiteboard for writing up pupils’ ideas about debugging
•An interactive whiteboard to display Scratch as you work through this lesson
•Pizza Pickle teachers’ presentation 2.0 or Pizza Pickle teachers’ presentation 1.4
(see download link at bottom of webpage)
Pizza Pickle Orders Worksheet 2.0 or Pizza Pickle Orders Worksheet 1.4 (see
download link at bottom of webpage)
Pizza Pickle Helpsheet. 2.0 or Pizza Pickle Helpsheet 1.4 (see download link at
bottom of webpage)
•
•
Before you start
•Download the Pizza Pickle file appropriate to your version of Scratch and save
to a location on your network for pupils to access, or ensure they have access to
Scratch 2 online.
Print out and photocopy the Pizza Pickle Orders of programs with bugs (one per
child)
Print and give out and photocopy Pizza Pickle Helpsheet (one per pair)
Read the Teaching Notes - concepts and approaches on page 10.
•
•
•
Organisation
Pupils will need access to Scratch 1.4 or 2.0. This activity is most effective if using
using Scratch 2.0. Ideally, pupils should work in pairs for this – it’s probably best to
partner less confident coders with those who are more confident with Scratch.
Introduction whole class (5 - 10 mins)
•Bring children to the carpet.
•Show children the commands page of the presentation as below. Ask pupils what
they think they will be programming and what programming language the activity
might be created in. (Answer – making pizza using Scratch)
Version 2.0 and 1.4
•Open the Pizza Pickle scratch file. You might find it useful to revise the areas for
scripting, pointing out to the pupils the steps they need to go through to find the
block they will be using. See the images below for these steps. If needed use the
slides below to remind children after you have walked this through, or use them
as helpsheets.
KS1 Pizza pickle debugging activity
page 2/12
Version 2.0 This image is included in the helpsheet.
Version 1.4 This image is included in the helpsheet.
•Make sure that pupils can access the pizza pickle commands (see image above).
•Ask them what the different commands might do and how we might use them. But most importantly how we can find out. Lead them to the idea that they could
tinker. Explain we are going to focus on finding out about the special purple
commands (2.0) or broadcast message commands (1.4) not the rest of Scratch
today.
Remind them of the areas; the stage area (where they will see the output from •
KS1 Pizza pickle debugging activity
page 3/12
the program), the blocks palette (More Blocks) (in 2.0) (where they can get the pizza commands from), the scripts area (where they will write their program).
Tinker time (10 mins)
•Demonstrate how your pupils will access the program by clicking on the down
loaded Pizza Pickle file. Show them how to click on ‘File’, ‘Save As’ and save as a sensible file name in an area on the school network so that each pair will have their own version of the project file e.g. Sam Chloe Pizza (unless pupils are working with their own Scratch online accounts).
Selecting ‘File’ then ‘Save as’ in Scratch 2 and 1.4 to save a copy of the project.
•If your class needs this, or for those requiring extra support, show them how to click on the commands to run them and how to snap the commands together.
Show them how to use the help sheet if they get lost.
Show them how to quit and re-open the pizza pickle file if they get in a pickle!
Give pupils 5 minutes to tinker with the program.
During this time, encourage pupils to try the pizza commands. Ask them to click on each block and see what it does. Ask them what surprised them, what it can or cannot do. Ask pupils to demonstrate to others what they find out.
In Scratch 2.0 remind children to click on ‘More Blocks’ if they get lost in the Blocks palette.
•
•
•
•
•
Introduction to debugging (10 mins)
•Return children to the carpet.
•Ask children to discuss with a neighbour what they found out and then discuss as a class. Children could show their discoveries on the IWB by demonstrating what the commands do and how they work. Ensure that all the commands have been explored.
If necessary use the Programming Commands page of the IWB as shown below
(slide 4), or the Pizza Pickle Helpsheet or click on each command to show them.
(Remember to click on green flag after you have run each command to clear the
stage).
•
.
KS1 Pizza pickle debugging activity
page 4/12
Version 2.0 This image is included in the help sheet
Version 1.4 This image is included in the help sheet.
•Ask pupils what they think a bug in a program is. Explain it is when we want a
program to do something but it does something different.
•Ask pupils what they think debugging is. Explain if there is a bug then getting rid
of it is called debugging.
•Explain that bugs are a common thing when we program. Even professional
programmers have to debug. Often half of the time they spend programming is
spent debugging, so we have to get used to doing it too!
KS1 Pizza pickle debugging activity
page 5/12
• Share the learning intention page, if this is your normal practise.
Please adapt to your schools format, if used.
•Explain there are some pizza orders for the pizza shop, but the programs are in
a pickle – they have gone wrong. What do we call it when the program does not
do as we expect? It has a bug in it – we need to debug.
Explain that sometimes it’s helpful to have steps to help us debug. (Don’t worry if
they don’t remember these – they will gradually grow to remember them as you
remind them continually and they are on the Pizza Order Worksheet!)
We work out…
• What should it do?
• What does it do?
• Where does it go wrong?
• Fix it.
Show them the next slide and read out what the program should do and then
ask the pupils to work out with their partners what they think the program will do.
Take ideas from the class and address any misconceptions by modeling how to
look at each command and talk through what you think it will do and therefore
what the program will do. (Some children may say it will be fine, others may spot
it has not been cooked, or that it has no topping it is important for pupils to predict, rather than being told what will happen at this stage.)
•
•
•
KS1 Pizza pickle debugging activity
page 6/12
Plain pizza order version 2.0
Plain pizza order version 1.4
•Show children how once you have predicted what will happen, how it can be
tested. Click the green flag to show you are clearing the stage.
Then snap the commands together and click on them to run them.
Model clearly talking through where the bug is, modelling the use of logical thinking. Saying something like “So it makes the base, there is the oven – but it’s still
in the oven, what command do I need to get it to cook. There is a ‘start cooking’
– maybe I need to add that at the end, lets try it’.
Demonstrate testing what the original buggy code does. Then demonstrate fixing
it. Drag the extra command ‘start cooking‘ and snap to the end of the sequence.
Press green flag to clear the stage and re-test by clicking on the new program
•
•
•
KS1 Pizza pickle debugging activity
page 7/12
you made. Talk through it and say yes a plain pizza with no toppings.
•(This may seem like overkill, modelling these debugging steps for such a simple
bug, but it is well worth getting children into the habit of thinking through the debugging steps as habit, it will help enable them to be more independent as they
move onto creating more complex programs and therefore fixing their own bugs.)
Purposeful programming (30 mins)
•Show the children the Pizza Pickle Order Worksheet as below.
Pizza pickle order worksheet version 2.0
Pizza pickle orders worksheet version 1.4
•Show them how you filled in the plain pizza row (just jot the new commands in
the fix it column).
KS1 Pizza pickle debugging activity
page 8/12
•Show them the next pizza order and the buggy program to make the order. Ask
them what they think it will do? Where do they think it goes wrong? Those who
are confident to have a go, send them off to predict what is wrong, to snap the
commands together to write the buggy code, test it and then fix it (debug).
For those that need more modelling, walk through the process for next pizza
order. Look at each command, what will it do? Where does it go wrong. The most
important thing is to keep returning to the debugging steps.
• What should it do? Make 1 pizza with sauce.
• What does it do? Makes a pizza with cheese.
• Where does it go wrong? There is add cheese.
• Fix it. Change the add cheese command to add sauce.
In the end they will learn by doing, they just have to have a go and persevere.
Some will find this harder than others, those with an attention to detail and patience may find this easier than those who expect to know straight away. But they
all need to learn for themselves.
Ask pupils to explain the steps they use to debug the sets of commands and get
them to share with the class any clear explanations where they have followed
the debugging steps e.g. I knew it had to make a cheese pizza but the program
added basil so that is where it went wrong so I got rid of that command and it
worked.
If pupils finish the example buggy programs they can write in their own pizza
order, get their partner to create a program with a bug, then get the person who
raised the order to work out what the buggy program will do and fix it. They might
also work collaboratively to help other pairings who are struggling. Or they could
investigate how the the pizza pickle blocks / commands work and report back to
the class what they find (See Teaching Notes - Programming on page 11).
•
•
•
•
Plenary (5 mins)
•Ask pairs to share with another pair which was the hardest bug to fix and why.
Share ideas.
•Share any buggy programs that children have created during the main task and
see if you can fix them as a class or make up one for them to fix e.g I want a basil pizza but the program was make base, add basil, add cheese, start cooking.
Explain to children that almost always there are bugs in programs, bugs are not
a problem, they are just something that happens when we program. People who
can find bugs are great programmers. Suggest a bug finder display, or sticker
or award. Only those who can find bugs have any chance of fixing them. Pupils
could start a programming journal where they jot down ideas and bugs they
found.
•
Differentiation
Support:
Consider mixed pairing for less confident pupils to be supported by their peers,
however ensure that the more confident of the pair works collaboratively being
supportive rather than taking over the task. An additional adult, if available, could
work with a small group of pupils requiring additional support.
•
Stretch & Challenge:
Pupils can be challenged to clearly explain every step of the how they have
debugged a program and to support others in debugging. However be very
mindful to train them to work collaboratively and to ask their peers the debugging
•
KS1 Pizza pickle debugging activity
page 9/12
steps, rather than giving their peers the answers!
•Pupils could also investigate the pizza pickle programming language. In the
2.0 version they can look at the code that defines the custom blocks, this can
be found at the bottom of the ‘make pizza’ scripts area, or in 1.2 they can trace
through the broadcast commands.(See Teaching Notes - Programming on page
11
Assessment opportunities
•A selection of open questions have been provided throughout to help encour-
age and gauge pupils’ developing understanding of debugging simple programs.
Pupils who work out what the program should do, what it does do, where it goes
wrong and then fix it are making good progress. Pupils who look at each command in turn and explain their thinking are making good progress. Pupils who
haphazardly try changing things with no reason are not making such good progress, even if they fix the bugs!
Pupils record their learning on their handouts – these can be marked.
The following questions can be used to assess progress and encourage a logical
approach to debugging:
• What should it do? Show me where it tells you.
• What does it do? How do you know that?
• Where does it go wrong? Show me how you know that.
• Have a go at fixing it yourself.
•
•
Teaching Notes
Alternatives to Scratch
Scratch is not the only visual programming language that can be used for this
activity. Scratch Jnr, Hopscotch, Kodu or other visual environments can be used.
If an alternative language is chosen then a program needs to be prepared that
requires debugging.
Concepts and approaches
Debugging
The process of detecting and correcting the errors in a program is called debugging. Bugs happen in programs all the time and therefore debugging is an important skill to have. In this activity as pupils construct the program they are encouraged to constantly test it, after they add each new commands and debug it if an
error has occured.
Pupils are debugging when they take the sets of commands and work out:
• What should it do?
• What they do
• Where they go wrong
• Fix them
You could make up actions for debugging steps and share on the Barefoot website. You could make a class poster of these steps and as you find out more about
debugging add extra notes, perhaps have a bug of the week and give stickers to
KS1 Pizza pickle debugging activity
page 10/12
It is particularly important skill for children to learn that they decompose their problem into parts, and program a part, debug it, and then add the next set of steps.
Giving pupils challenges with intermediate stages is a great way to encourage
decomposition and debugging as you go skills.
Programming
Programming is the act of purposefully combining commands in a programming
language to create a program to solve a problem. The pizza pickle programming
language has been written in Scratch just for this activity. This special pizza pickle
language only has a few commands and how it works (the syntax) is very simple.
The Scratch 1.4 version of the pizza pickle programming language uses yellow
broadcast blocks to create the pizza pickle commands. Whereas in 2.0, purple
custom blocks have been used to create the pizza pickle commands. Custom
blocks are not available in 1.4.
Version 2.0 allow coders the opportunity to create new blocks (the purple ones)
in the ‘more blocks’ pallet. This allows us to hide the complexity of what is ‘inside’
these blocks from the person using them.
If pupils delete the yellow broadcast commands in the 1.4 version it is probably
easiest if they close the pizza pickle file and start again by reopening the original
file. But if they are using version 2.0 pupils can find the ready customised blocks in
the purple ‘more blocks’ pallet.
As an extension, perhaps suited to more confident pupils and teachers, how the
custom blocks work in 2.0 can be investigated, as can how broadcasts work. In
actual fact the custom blocks in 2.0 just hide broadcast commands. For example,
the blocks used in the 2.0 version of Pizza Pickle were simply copied from the 1.4
version. The custom blocks in 2.0 are defined on the make pizza script area at the
bottom, just scroll down on the stage area to reveal the following.
.
Version 2.0 of pizza pickle uses custom blocks to hide the broadcast commands.
To investigate the broadcast commands, in 1.4 or 2.0, click on the different sprites
to see where the broadcasts are raised or waited for. How broadcasts work is
looked at in more detail in activities such as KS2 dinosaur fossil animation. Perhaps pupils could create their own blocks to add their own favorite toppings, such
as mushrooms or pineapple?
KS1 Pizza pickle debugging activity
page 11/12
Logic
When pupils predict what the sets of commands will do they are using logical
reasoning to think what they have seen the commands do before and apply this
knowledge to the problem in hand. It is important to encourage pupils to explain
their thinking, this not only shows whether they are thinking logically, but also
helps them to think through their own ideas. Being able to explain what we think a
program will do is very important not only when we first create a program but also
when we debug it.
Persevering
Persevering means being determined, resilient and comfortable with not knowing
the answer and having to work on a solution for some time. When solving problems there may be many alternative solutions, sometimes it is not clear which is
the best until you have tried them, so pupils may have to try out a number of alternatives to better able to compare them.
Taking this further
BBC What are computer bugs
http://scratched.gse.harvard.edu/resources/debug-it
http://wiki.Scratch.mit.edu/wiki/Debugging_Scripts
Related activities
Lower KS2 Fossil formation sequencing activity
KS2 2D Shape Drawings – an introduction to debugging algorithms
KS1 Pizza pickle debugging activity
page 12/12
Download