video

Lesson video

In progress...

Loading...

Hello, and welcome to the first lesson of computer programming.

Now, I'm Ben, and I'm going to take you through this unit.

Now, this lesson is all about sequencing.

Now, whether or not you've done programming before, or you've got no programming experience, don't worry because this unit's really going to give you a foundational understanding of computer programming and give you a set of skills that you'll be able to use to develop your programming skills even further.

So, all you'll need for today's lesson is a pen and paper, and we're also going to need a web browser, and we're going to be using a software called Scratch, which is all online.

Now, if you want to save your work online, you'll need an account.

So, if you're under 13, you'll need to get a teacher, a parent, or a carer to create that for you.

So I'm wearing my Scratch t-shirt to get us in the mood.

If you've got a Scratch t-shirt, then go and grab that.

Otherwise, you need to go and get a pen and paper.

You need to turn your mobile phone off, try and remove any distractions that you might have.

And when you're ready, we'll begin.

Okay, so in this lesson, you will compare how humans or computers interpret instructions and what the similarities are and what the differences are.

We're going to look at what a sequence is, and then we're going to use a Scratch programme to modify a sequence.

So, to kick us off for today's lesson, I've got a question for you, and it is one that requires you to think about the difference between computers and humans.

So, can the computer do the job of a musician? Now to answer this question, you really need to think about what does a musician do? I mean, do they just play music, or do they do more than that? And those other things that a musician does, can the computer do that job as well? Okay? So we're going to pause this video right now, and I'd like you to really think deeply about that question.

So don't just give me a yes or a no answer.

I want one that's maybe a bit more expanded than that.

So if you think the answer is yes, a computer can do the full job of a musician, then, first of all, make sure there's no musicians around you because I'm sure they would get massively offended by that.

But if you think the answer is that they can do that, then justify why you think that.

But if you think the robot or the computer can't do the job of a musician, then what is it about the job of the musician, the human elements of the musician, that maybe a computer can't do? So when you've got an answer for that, then you can unpause when you're ready.

Okay, so let's unpick this answer ever so slightly.

Now think about the job of a musician.

Now, I've been learning the ukulele over the last few weeks, and I've got to a point now where I can recognise what the notes are, and I know which chord to play or which notes or which string to pluck.

And I also can read some of the other information that I can see, such as the tempo, such as how quickly to play it, but what makes my playing of the ukulele a little bit different to maybe an international, world-famous ukulele player? Well, they can probably do things that I haven't learned to do yet, such as they can play it with a bit more flair or maybe they can make up some music to be a bit creative.

So the question is, could a computer do those things? Could it be creative? Could it make things up? Could it do things that aren't on the script or the sheet music in front of it? So let's change the context slightly and get you to do another exercise.

And this is where you're going to need your pen and paper.

So hopefully, I want you to really have a little bit of fun with this exercise, and I would like you to get your piece of paper, and I'd like you to, maybe if you want to draw a map, but I'd like you to draw a route from where you're sitting now to maybe another room in the house.

Now, don't get too carried away with this.

So don't go and draw somewhere that's a long way away, maybe just to the next door room or something like that.

Now, once you've done your route, I'd then like you to convert that into a set of instructions.

So write down precise instructions that you might feed into a robot, and the robot will be able to follow those instructions to the letter and be able to get from where you are now to your new room.

If possible, it'd be really great if you could rope somebody into doing this exercise with you.

So if you've got someone else in your house, and they're able to do it, then maybe you could get them to come along once you've drawn your route and written your instructions and get them to follow your instructions and see what they do with them.

Do they get from where you are now to the next room? Or were there any problems that they came across when they were following your instructions? Okay? So I'd like you to pause the video, give all that a go, rope in somebody if you can, but if you can't, then you just follow your instructions and put yourself in the mindset of a robot, if you can, and try and follow those instructions exactly.

And when you've done all of that, then unpause the video.

Okay.

So how did you get on with that? Hopefully you had a bit of fun with that, and I'm really curious to know how that went.

Did the person or yourself, when you were doing it, did you just do it first time, did it work perfectly? And if you did, why was that, do you think? And if it didn't work perfectly, what was wrong with your instructions? Did the person playing the role of the robot, literally play the robot and follow your instructions exactly to the letter? I kind of hope they did, really, because when you're writing your instructions, were you precise enough? When you wrote go-forward, for example, which you might have done, did you specify exactly how far forward? Did you say five footsteps, or did you just make the assumption that go forward until you hit a wall? Now that would be great for a computer or a robot.

Think about maybe when you then had to turn left and right.

Did you say turn left or did you specify how far to turn left? Because if you said just turn left and a human's doing this, I would say, if someone told me to turn left, I think I would naturally just turn left maybe 90 degrees, but that's because I'm making an assumption, I'm kind of filling in the gaps in your instructions because I'm interpreting them and using my brain to kind of work out what you meant.

The question is, would a computer do that? Would have robot do that? Would it assume that you mean 90 degrees, or would it just keep moving left until it was told to stop? So, reflecting that a little bit more, I've got one last question to end this section of the lesson, and that is, do instructions given to computers, instead of humans, need to be more precise, as precise, or less precise? Okay? So I want you to say the answer out loud.

So three, two, one, and it is more precise.

What we've been trying to get at for the last two exercises is to get you to understand that computers need really precise instructions and what they don't do is they don't behave like humans, and they don't fill in the gaps, they don't make assumptions, but they need those instructions to be precise.

So when we get to some programming later on in today's lesson, it's really important that we remember this because your computer will do exactly what you tell it to.

Okay, so very shortly we're going to have a go at some computer programming, but before we do, let's have a look at some key concepts behind computer programming and what exactly is meant by computer programming.

So here's a sentence that I really like, which kind of sums up what computer programming is, and it's that "programming is how you get computers to solve problems." Now, within that sentence, there were two key phrases that are really important, and the first one is "you." Now without the programmer, I.

e.

you, the computer's really useless, so it is going to do exactly what you tell it to.

So you are the power behind any programming, behind any programming is the programmer.

So a computer will follow the instructions and the commands that you're going to give it.

And the other part of that sentence which I think is really important is solving problems. So computers are tools.

I mean they're complex tools, admittedly, but they're not mysterious or magical.

But they exist to automate tasks or to solve the problems that we want them to.

There are three key concepts.

So for the next set of lessons, you're going to look at the three key programming concepts, and they are sequencing, selection, and iteration.

Now, sequencing, as we're going to find out for the rest of this lesson, is that they are running instructions in order.

That's what's meant by sequencing.

Where selection is making choices, and iteration is doing the same thing more than once.

So it's repeating instructions and doing them over and over again.

So those are the things that we're going to work on over the next few lessons.

But like I said, in today's lesson, we're really going to look at sequencing.

Now, what is meant by sequencing? Well, sequencing are instructions performed in order with each one executed in turn.

So as you have seen already in this lesson, computers will follow your instructions precisely, and in the order in which you tell them to.

So what I'd like you to do now is I'd like you to think of any non-computing related examples where instructions need to be carried out in the correct sequence.

Now I've got an example, as you can see on the screen there, the picture that will give you a clue.

So I'd like you to, again, pause this.

So think about the non-computing related examples where you come across something where instructions have to be followed through in order.

So when you're ready, when you've come up with an answer, and you've got a couple of examples, then you can unpause the video.

Okay, so I wonder what examples that you came up with.

Now you can see on the previous slide, I gave you the example of a recipe.

So why is a recipe, a recipe book, sorry, a good example of a sequence? Well, if we look at any recipe and inside a recipe book, then we would see a set of instructions that need to be carried out in the order in which they've been stated, because it wouldn't make sense to start with the last instruction, which might be to serve the meal.

And then go back to the first instruction, would be to chop up the ingredients.

That wouldn't make any sense.

What we'd have to do is follow them through in the order to get a nice meal.

So the other example that really kind of sticks out in my mind is a kit, a Lego kit.

Have you ever received a Lego kit? They come with a set of instructions.

Now, those instructions tell you what bricks to use and then what to do with those bricks.

And you've got to, again, follow them through in an order, in a sequence, and then you come up with your finished product.

What, again, you can't do is decide you're going to start with instruction one, then go to instruction seven, then go to instruction three, because you wouldn't be able to put the kit of Lego together in the right order, and it just wouldn't work.

So, I'm sure you came up with some really great examples as well, but those are two that really helped me understand what sequence is.

So, let's look at this music score.

Now, the first question is could a computer play music in a sequence? Now, I think we've already decided the answer is yes to that.

But what extra information can we see in this music score that we might be able to give to a computer that it would be able to follow through, follow through the instructions that we give it? So we can see there we've got the notes on the screen, and they tell it what note to play, obviously.

But also, you can definitely see a sequence there, you can see in which order to play it.

You can also see some numbers on the left-hand side.

And again, I apologise, I'm really going to the maximum limit of my knowledge on music, but you can see four, four, which means that it is four beats per bar, which means every one of those notes represents a beat, unless there's something slightly different because some of them are slightly different shaped.

So they might have holed out in the middle or they might have that bar next to them, which tells it what tempo to play it.

So maybe there's two beats per bar, two notes per beat, or maybe one of those notes needs to be played for two beats.

So that's the extra information that we can use there, which would help the computer play it in the way that in which we would like it to.

So let's have a look at this sequence.

Now, you keen musicians out there might have already read this music and instantly been to tell that it is "Frere Jacques" that this score of music would play.

Now, if you've never heard "Frere Jacques" before, don't worry, we're going to play it now.

And we're going to play it twice because the first time I'd like you to look at the score whilst it's playing and see if you can identify the notes that are being played as and when we hear it, so read it from left to right, and then we'll get going.

So we'll have a go at playing it.

So here we go.

Okay, so hopefully you were able to follow that through and notice what notes were being played when.

But this time I'd like you to look at the lyrics because "Frere Jacques" has some lyrics, and each one of these bars, really nicely, actually, if you look at the music score, each one of those bars represents a line of the words that go with the song.

So, if you're feeling confident and happy, then sing along with this.

I'm not going to sing along with it because no one needs to hear that.

I told you that I can play the ukulele, but I can't sing.

So we're going to run that through again and go through each line at a time.

Okay, perfect.

Okay.

So, we're going to use our knowledge now of sequencing and "Frere Jacques," and we're going to have a go at making this sequence in Scratch.

Okay, in a minute after I've shown you some instructions, I would like you to head over to your worksheet, and on the worksheet has a hyperlink.

Now that hyperlink will take you to this Scratch page, and what you need to do from here is you need to click on "see inside" to carry out the instructions.

So hopefully it will let me do that.

It's doing that in a second.

Now, remember if you have a Scratch account, or if you don't have a Scratch account, then you need to ask a parent or a carer or your teacher to create an account for you.

But if you already have one, it will make sure you're logged in, and it will save it automatically.

And if you don't want to do either of those things, you can just click at any point on file and you can save to your computer.

And if you have a copy of Scratch saved on your computer, then you can run it from there as well.

Okay? So you can see on the screen here, we've got kind of a partially completed version of Scratch.

I'm going to move my web cam around a little bit, just down here for the time being, so you can see this window.

Now we've got here are things called subroutines.

Now my subroutines are currently empty, and they don't have any information inside.

They don't have any sequences inside them.

But what I've got here is some kind of sequence created.

So when it says, that's a green flag, when that green flag is clicked, it's going to set the instrument to a piano, and then it's going to play this subroutine here.

So "Frere Jacques" here, and you can see there's nothing inside that.

So when I click the green flag, it won't do nothing.

I mean, it will set the instrument to piano, and then it will look for that subroutine "Frere Jacques" but then there's nothing inside that.

So you won't hear anything, but we'll test it out anyway, 'cause it's always good to test out your programmes as you go along.

So I'm going to click on the green flag.

And you can see that actually nothing's happened, we're not hearing anything, which is kind of what we expect.

So to make this work, the first thing we need to do is we need to maybe start putting our subroutines in the right order.

So for example, if you remember from the song, it was "Frere Jacques" then "Frere Jacques" again.

So I would pick that subroutine, and I would put it inside there.

But then I need it to play "Frere Jacques." So what we do have is these sequences here that aren't attached to anything.

Now to listen to what they sound like, and you can see some of the information that we spoke about that you might be able to see in the music score is there.

So that's what note to play and maybe how quickly to play it.

So if I click on this.

Okay, so that was, yeah, that wasn't the "Frere Jacques" part.

So I'm going to keep going along until I find the "Frere Jacques" part.

Let's click on this.

No, I'm not sure that was either.

Or that.

We'll get there eventually.

There's only one left, so hopefully it will be this one.

Yeah, you can hear that.

That's the, ♪ Frere Jacques ♪ told you I can't sing.

So I want to get this one.

I'm going to hold down my mouse button on the top one, make sure you don't click the bottom ones 'cause that kind of undoes the sequence.

So you must make sure that you click on the top one of the sequence, and I'm going to click it here, and I'm going to put it inside my "Frere Jacques" subroutine.

Oh, I just need to move it on screen a little bit, but it's not letting me.

So, there we go.

It's being a bit fiddly, but we'll get there eventually.

Oh, I've gone too far.

We'll get there.

Come on, right.

So drag it along here, and I think "Frere Jacques" was up there.

There we go, you can see "Frere Jacques." So I'm going to click on that and just drag it under the sequence there.

That's sequences in my routine, so it's a subroutine.

So it's going to see "Frere Jacques" there, and it's going to go, "Oh, I have to find something called 'Frere Jacques,'" which is these set of notes, and it should play that.

And then it will play them again.

So let's see if that works now.

Perfect, and it's done exactly what I tell it to.

Now, if I was to kind of move around just to prove a point, if I was going to click on, I don't know, put "ding, dang, dong" there, and then "Frere Jacques" here, oh, stop, stop, stop, sometimes when you click on it, it kind of activates that sub-routine, give you a preview of it.

So, I'll click on the green flag, set instrument to piano, "Frere Jacques, ding dang dong, Frere Jacques." Now I haven't told it what "ding dang dong" is yet, so you might just hear silence there.

So let's see.

So that's that one.

Hmm, so it doesn't look like anything's different, but that's because nothing was put inside "ding dang dong." Okay? So, like I said, if you go to your worksheet in a second, I'll come back to this.

You need to put these in the right order.

So, put your sequence in the right order, and then tell it what to do for each line of the song.

So, go down to your lines of code, click on them, preview them, listen to them, put them under the right subroutine, and then you should be able to hear "Frere Jacques" being played in order.

Don't worry that you get anything wrong, just keep playing around with it until you get that sequence right.

Okay, so let's just head back to the slides.

Now, what I'd like you to do is follow those instructions.

So go to your worksheet, your worksheet will take you through exactly what you need to do and in what order, in what sequence.

So I'd like you to pause this video, go to your worksheet, follow through the instructions.

Now, there are some Explorer activities on there.

So if you found that really straightforward, and you want to push your skills a little bit further, there are some extra instructions where you can make something called a round with "Frere Jacques." So give that a go, and when you finish the first set of instructions, then you can resume the video, and we'll complete the lesson.

Okay, so that brings us to the end of today's lesson, and a really, really big well done.

You've done a fantastic job with that.

Now there's only two things left for us to do, and one of them is I would like you to write down the three most important things from today's lesson, and it's up to you what they are.

And secondly, we would really love it if you shared your work with us.

So if you'd like to, please ask your parent or carer to share your work on Instagram, Facebook, or Twitter, tagging @OakNational Academy and #LearnwithOak.

So I hope you enjoy the rest of your learning for today, and I'm really looking forward to the next lesson already.