Loading...
Hello, my name is Ms. Powell and welcome to Computing.
I'm so pleased that you decided to join me today.
In today's lesson, we are going to be learning how to think about what works well and what could be better in our programmes.
This is called evaluating.
Let's get started.
Welcome to today's lesson from the unit building sequences in programmes.
This lesson is called Evaluating and Improving a Programme.
By the end of today's lesson, you'll be able to evaluate and improve a programme.
We will be using these keywords through today's lesson.
Let's take a look at them.
The first word is template.
Template, a pre-made project that you can open and use.
The next word is evaluate.
Evaluate, to think about what works well and what could be better in a programme.
The last word is debug.
Debug, and that means to find and fix errors in a programme.
Today's lesson is split into two sections.
The first section, we'll be looking at evaluating a programme, and in the second section, we'll be looking at debugging a programme.
Let's get started with the first section, evaluate a programme.
Evaluate a programme.
In ScratchJr, event blocks are the actions that trigger programmes to start.
Here, you can see three event blocks.
Do you know them all? The green flag block means the programme will start when the green flag is pressed.
The start-on-tap block means the programme will start when you tap on the sprite.
Look at this icon.
How do you think this event block will work? Pause the video and have a look at the event block.
See if you can work out how it will work.
Well done for having a try.
This is the start-on-bump block.
When a sprite with this block is touched by another sprite, the programme will start.
If you look at the block, it does look a little bit like two sprites bumping together.
Watch this video to review the three event blocks.
I'll start it now.
<v Instructor>In this programme, I'm going to demonstrate</v> the three types of event blocks.
So the chicken here has got a green flag block.
The lizard has a start-on-tap block and the penguin has a start-on-bump block.
Now let's demonstrate all those.
So when I press the green flag, the chicken's actions have started.
The code ran there with this green flag, but the lizard and the penguin didn't move.
So let's see why that was.
So the lizards programme will only start when I tap on the lizard, and as I do it now you'll be able to see.
So the penguins code also started.
Let's see why that was.
The penguins code is a start-on-bump.
That means when another sprite touches the penguin, the penguins code runs.
So when I tapped on the lizard, it bumped into the penguin.
And let's run everybody's code altogether so you can see how that looks.
<v ->Different event blocks are useful</v> for different programmes.
You should use the event block that makes your programme begin in the way you want.
True or false? Start-on-bump is a motion block.
What do you think? Is that true or false? Pause the video to have a try.
The answer is false.
Why is that? Start-on-bump is an event block.
It starts a programme.
The start-on-bump block is used in this programme.
The programme is called Bump.
What do you see here in the screenshot? I can see three sprites.
There's a yellow duck, a blue duck, and a green duck.
It looks as if they're in a sink background.
What do you see in the programming area? I can see some command blocks there.
I can see the start-on-bump block.
I can see a move right block, a move left block, and a move right block.
I wonder what will happen when this programme is run? This programme is a template, which means that it is pre-made for you.
You can open and explore it.
To get to the template, start in the main menu.
Tap on the question mark icon.
The Bump project is on the bottom row.
Can you see it there with the three duck sprites? When you make a programme, you should be checking and testing it as you create it to find and fix any errors.
When a programme is finished, you can evaluate it.
Evaluate means to think about what works well and what could be better in a programme.
I need your help.
What do you think? When the coding project is finished, you should, A, evolve it, B, evaluate it, or, C, exit it.
Pause the video and have a try.
What do you think the answer is? Is it A, B, or C? Well done for having a try.
The correct answer is B, evaluate.
When you finish your programme, you should evaluate it.
You should try and think what went well and what could be better.
To evaluate a programme, first look through the command blocks for each sprite, examine the command blocks to predict what you think will happen.
If there's more than one page, you should also check the other pages.
When you have read all of the command blocks, you should run the programmes.
Look at the event blocks to see how to start the programmes.
So if I look here in the programming area, I can see start-on-bump block.
That's telling me how the programme starts.
In the Bump project, you should start the programme by tapping the green flag.
If we look at the command blocks, we can see start on green flag is the first block.
Then if we read the other blocks from left to right, we can see that we have got a move right block, a move left block, and a move right block.
If a sprite has a start-on-bump block, the programme will be triggered when the sprite is touched by another sprite.
So if we look here at the command blocks, we can see start-on-bump block.
Then we have a move right block, a move left block, and a move right block.
So this programme will start when that sprite is touched by another sprite.
So now once the programme has finished running, choose one thing that you enjoyed about the project.
This is Izzy, and Izzy says the background was a photo of a sink, which made the project feel realistic.
I think that was also a really nice touch to this project.
This is Jacob.
Jacob says all three of the sprites finished in the same position that they started in.
That's something that Jacob really enjoyed in this project.
The next evaluation step is to think about what would make the project even better.
I wonder if you've got any thoughts what could make this project even better? Perhaps we could add some command blocks? Or we could take some away? Think about all of the effects that you can programme.
There's lots of other things that could have happened in this programme.
The sprites could have gotten bigger or smaller.
We could have had a background change.
Perhaps the sink could have changed to a bubbly bath or we could have had our sprites hide.
There's lots of things that could have happened.
Sharing your ideas can help you think up even better ones.
Sam says, "Adding a speed block to some of the ducks could be fun." And Sophia thinks, "Good idea, I want to use a say block.
so when a duck gets bumped, it quacks." Well done and fantastic listening.
Evaluate a programme.
When you are designing coding programmes, you use algorithms to record your plans.
An algorithm is a precise set of ordered steps that a human or computer can follow to complete a task.
Here is an algorithm for this programme.
If you look here at the picture, I've got three sprites, a lizard, a chicken, and a penguin.
Let's look at the lizard sprite.
I've got it here in the programming area.
The algorithm says start-on-bump, fast speed, move 11 steps right, move 11 steps left, and end.
Let's take a look at our command blocks and see if they match the algorithm.
It looks as if my event block I've used here in my programming area is start-on-tap.
That's different from what I'd written down, start-on-bump.
I do have my speed block, that's the same, and I have my move 11 steps right, and I have my move at 11 steps left.
Those blocks are the same, and the end block.
However, if we look at the command blocks, my programme starts differently than the algorithm I have written down.
I've got a task here for you.
I hope you're ready to give it a try.
Open and run the Bump project.
Write an algorithm for each duck's command blocks.
So if we take a little look at the command blocks in the programming area for our first duck, blue duck, what do we see? I can see start-on-bump block, then I see move right four steps, move left five steps, and move right one step.
I need to write all of those steps out as an algorithm.
Pause the video so you can try the task.
Well done for having a try.
Did you write an algorithm for each duck's command blocks? I've got here the algorithm so you can check.
Is it the same as mine? Yellow duck, green flag, move four right, move five left, move one right.
Did you get some of them the same as mine? Well done for trying.
Blue duck, start-on-bump, move four right, move five left, and move one right.
Green duck, start-on-bump, jump five, and jump five.
Well done for trying to write those algorithms. I've got another task here for you.
We are going to keep on evaluating this programme.
I'd like you to record one thing that you liked about the project.
Then I'd like you to record three ways to improve the project.
This might be by adding additional command blocks.
Pause the video to complete the task.
Well done.
You've done really well evaluating this programme.
Did you record one thing that you liked about the project? I've got an answer here.
Perhaps it's similar to mine.
I liked that the ducks were different colours.
And did you try recording three ways to improve the project? Perhaps your answers are similar to mine.
You could add a say block after the event block so the duck makes a quack.
You could use speed blocks to make the duck swim faster or slower.
You could use a hide block to make a duck disappear when it is bumped.
These are my ideas.
Perhaps you've had lots of your own.
Fantastic work.
This brings us to the end of our first section, evaluating a programme.
Let's now move on to our second section, Debug a programme.
Debug a programme.
Errors and programmes are sometimes called bugs.
When you debug, you're finding and fixing errors.
Debugging means looking closely at a programme and algorithm to see where the mistakes might be, but try not to worry too much about errors even though they can be frustrating.
Errors are a normal part of programming.
And as programmers, it's our job to find and fix them.
If a programme doesn't work as expected, you can check the command blocks.
If you can't find the error, look at the algorithm.
Algorithms can help you find errors in a programme.
By reading the algorithm, you can check if the programme follows the correct steps.
Let's take a little look at the algorithm for the alien.
It says start-on-tap, say no, sound uh-oh, end.
Can you debug the following command blocks? Look at the algorithm to see what the programme was supposed to do.
I'd like you to read the algorithm and then take a look at the command blocks.
Can you see anything that's the same or anything different? Is there a command block that shouldn't be there? Pause the video to see if you can debug the programme.
Well done for having a try.
The final block, change page, is incorrect.
That is the error.
So if we look at our algorithm, start-on-tap, I have a matching command block start-on-tap block.
Next, say no.
I have that too, I have the say block.
The next step is sound uh-oh.
I have a sound block.
But when it comes to the end of the programme, I've used the change page block.
That wasn't what I had included in my algorithm.
So that block is incorrect.
That is the error.
It's supposed to be an end block.
We can fix it by swapping the blocks.
Debug the following programme.
Which command block is the error? I'd like you to have another try reading the algorithm from left to right and comparing it with the command blocks from left to right.
Do you notice any command blocks that shouldn't be there? Or perhaps a mistake? Pause the video to debug the programme.
Well done for having a look.
The error is the green flag block.
Did you find that? If you look here at the command blocks, I've started the programme with the green flag block.
But if you look at my algorithm, I've written down start-on-tap.
The green flag block is the wrong block to start my programme.
It should be the start-on-tap block.
I can swap my blocks to fix the programme.
True or false? If a programme works, it doesn't need evaluating.
Hmm, I wonder what the answer for this could be? Pause the video and try to work out if it's true or false.
Did you get false? Why? Even working programmes can be made better with improvements.
You can perhaps make them more efficient or more interesting by adding new features.
I've got a task here you.
I'd like you to give it a try.
Debug a programme.
Number one, create the Rocket Launch project.
Use these sprite backgrounds and programmes.
Pause the video to create the Rocket Launch project.
Well done for making that project.
I've got another task here for you.
I'd like you to watch this video about the Rocket Launch project.
Let's play it now.
<v Instructor>Okay, the first part of this task</v> is to go and add the correct backdrop.
So I'm going to go up to the backdrop button at the top, and scroll down until I find the correct backdrop.
Use the blue tick to select that.
Okay, now we're going to add some sprites.
The first sprite is the child sprite.
Going to select them, and tick, move it into position.
The next sprite is the ball.
It's down near the bottom.
There it is.
Move it down into place.
And finally, the rocket sprite.
Now the rocket sprite is at the very, very bottom of the list.
Add the rocket sprite to your programme.
Okay, now with the coding blocks, we're going to start with programming the child.
Child's programme starts with a start-on-tap block, then a say block, and then a move block, move to the right, and then the end block.
I need to change the value here.
This should be a three.
Great.
Now let's move on to the next sprite.
Now the ball sprite starts with a speed block, which is quite unusual.
That's not usually how we start a programme.
So that is a bit of a clue the next part of the task.
But for now, you can just copy the programme the same way that it was written.
So set fast speed on the speed block.
Then you're going to need a move to the right block.
That value should be four.
And then finish off with an end block.
Great.
Okay, and for the lust sprite, we're going to get the rocket and put some code on it.
For the rocket sprite, in the events menu, we're going to get a start-on-tap.
Then we're going to use the move down 11, and then the end block.
Now you might have noticed or thought about some bugs, some errors in this programme and there might be because that is what we're learning about today.
So as long as your programme matches the same code in the first part of the task, you are all done.
<v ->Well done for watching that video all the way through.
</v> Your next task is to read the algorithms below and compare them to your programmes.
Circle any parts of the algorithms that are missing or incorrect.
I've got here my algorithms for each sprite.
If you see here, the child, the algorithm reads start-on-tap.
Say three, two, one, lift off, move three steps right, and end.
Do you notice anything that's different from the command blocks that we used in ScratchJr? If you do, circle it.
Then I'd like you to try and do that for the ball sprite and the rocket sprite.
Pause the video to try the task.
We're done for having a go at debugging that programme.
Let's have a little look and see if you found any parts that were missing or incorrect.
If we look at the child sprite, the algorithm reads "Start-on-tap, say three, two, one, lift off, move three steps right, and end." If we look at the command blocks, we have start-on-tap.
That's the same.
We have a say block and it says, "Say hi." That's different from what I wrote down in my algorithm.
In my algorithm, I had planned say three, two, one, lift off.
But in my programme, my say block is say hi.
The next command block is move three steps right.
That's the same as my algorithm, and the end block is the same.
Let's look at the ball sprite.
My algorithm says start-on-bump, fast speed, move 10 right, and end.
Let's take a little look at the command blocks that I've used in my programme.
Did you notice I didn't have an event block to start my programme? I forgot that entirely.
I need to add the start-on-bump block.
Fast speed, I do have that block there.
Move 10 right.
Hang on a second.
That's not something I included in my programme.
I had move 4 right instead of move 10 right.
That's not the same.
The end block is correct.
Let's take a little look at the rocket sprite together.
So the algorithm reads start-on-bump, then move up 11, and end.
Let's compare it to the blocks.
Start-on-bump.
That's not the block that I chose.
I chose start-on-tap block there.
That's incorrect.
Move up 11.
That's also not what I've got here in my blocks.
I've got move down 11.
That's incorrect as well.
The end block is the same.
I've got another task here for you.
I'd like you now to debug the programme.
Use the algorithms to help you then test the programme.
So if we look at the child sprite, start-on-tap, that block is correct.
The say block was the incorrect block.
It shouldn't say, "Say hi." It needs to say, "Three, two, one, lift off." Perhaps you can fix that for me.
I'd like you to work through the programmes and try and fix the blocks that are incorrect.
Then test the programme and see how it works.
Pause the video to finish the task.
Well done for having a go at debugging that programme.
I've got another task here for you.
I'd like you to watch this video to review the fixed Rocket Launch programme.
Let's watch it now.
<v Instructor>In this part of the task,</v> we are going to look at the algorithms and fix all of the mistakes in this programme.
First things first, we are going to look at the child sprite.
So I'm going to put the algorithm up on the screen so we can all follow along together.
So the first thing that we need to change here is the say block.
At the moment it just says hi.
We want it to say three, two, one, lift off.
Oh, spelling mistake there.
Lift off.
Just like that, you could tap away to close that popup.
The move three right looks correct and then the end block looks fine, and it's starting with a start-on-tap.
So all the mistakes have been fixed there.
In the ball programme, let's see.
It's supposed to start with a start-on-bump.
That's missing.
So we're going to go into the events and get that.
Start-on-bump, the third one, pull that in.
So once we've got it, let's check out the speed.
Let's check it as fast.
If you tap on a speed block, you get your three choices of slow, medium, and fast.
This one is set to fast, and then the value here on this move right block needs to be much larger, it needs to be a 10 for the ball to go all the way across the screen to reach the rocket.
And then it's got an end block.
On the rocket programme, it's got a start-on-tap block, but actually it also needs a start-on-bump event to start the programme.
So I'm going to get rid of that.
Get the start-on-bump and then this movement block's not correct, it says move up.
And instead we've got a move down block there.
Can you see how the rocket was going the wrong way? So let's add a move up block instead.
That's it.
Change the value to 11.
Get rid of the old one and add the end block.
Now let's test this programme by tapping on the trial to start it.
Three, two, one, lift off.
There we go.
The rocket launched into the sky by the ball.
If your ball circles around the page a bit like mine did, that's just because of the way you've positioned your ball and your child.
You just might have to reposition those.
Otherwise, you're all done.
<v ->Fantastic, you've done so well in today's lesson,</v> Evaluating and improving a programme.
Let's summarise.
A template is a pre-made project that you can open and use.
The start-on-bump block is an event block that you can start a programme with.
When another sprite touches a sprite using this block, the programme will start.
When you evaluate a programme, you think about what works well and what could be better.
You can also debug a programme.
Debugging is finding and fixing errors.
That brings us to the end of today's lesson.
Well done.