video

Lesson video

In progress...

Loading...

Hi, I'm Rebecca, you're computing teacher for programming part one.

For this lesson you are going to need a pen and paper to make some notes.

And you're also going to need to remove as many distractions as you possibly can, so that you can really focus in this lesson.

Once you've done all of that, we can begin.

In this lesson you will compare how humans and computers interpret instructions.

You'll explain the differences between high and low-level programming languages.

You'll determine the need for translators and you'll list the differences, benefit's and drawbacks of using a compiler or an interpreter.

Think about it, which is better at interpreting instructions? A human or a computer? Pause the video while you have a think about that.

Humans versus computers.

Humans will make assumptions when given instructions, which usually get them to the right results.

However, computers need precise instructions because they can't make assumptions like humans.

Lost in translation.

Not only do computers need clear, precise instructions, but they can only understand one language.

Which is machine language or ones and zeros.

Instructions written in machine code can be directly executed by a computer's Central Processing Unit or CPU.

So, computers can make assumptions about instructions, which means that they don't need to be precise.

Is that true or false? It's false.

The first ever programmes were written solely in machine code.

Each instruction was entered by hand before being executed.

Operation code or opcode tables were used to help with this, but it was still very time consuming.

Can you imagine having to type all of those ones and zeros to get a programme to work? That would take a very long time, wouldn't it? To speed things up, programmers developed an assembly language.

This made the opcodes easier to read by using a mnemonic and an operand to form an instruction.

Each line of assembly language was equivalent to one line of machine code.

And you can see there, if I just go back one on the slides, that's the machine code.

So all those ones and zeros and then this is assembly language.

So the same lines of code, but this time it looks a little bit more familiar, it's still a bit confusing because you got opcodes and mnemonics there.

But it's a little bit easier to read than a load of zeros and ones.

This was great for the programmers, but the computers still couldn't understand the instructions.

Assemblers were created to automatically translate the assembly language into machine code.

So, programmers wrote in assembly language, which uses mnemonics and opcodes and then for the computer to be able to understand this, an assembler converted that code into binary code or machine code.

So an assembler is used to translate assembly language into machine code, is that true or false? it's true.

Assembly language and machine code are low-level languages.

Each line of assembly language is equivalent to one line of machine code.

The code is specific to the CPU that it is written for.

Assembly language soon became too time consuming because it was hard to read, debug and maintain.

A plain English language was needed.

Grace Hopper and that's a picture of her there on the right hand side, said, "Data processors ought to be able to write their programmes in English, and the computers would translate them into machine code." Grace Hopper conceived the idea of creating a compiler that could translate plain English code into machine code.

It took three years for her work to be taken seriously because people believed that, computers could only do arithmetic.

So machine code is a high-level programming language.

Is that true or false? it's false, it's a low-level programming language.

Fortran and COBOL were created as the first high-level programming languages.

These allowed programmers to write programmes in formal, structured English.

High-level languages made it easier to read, maintain and debug code.

This meant that programming computers became more suited to a wider audience.

These high-level languages could write one line of plain English code that would then be translated to dozens of lines of machine code.

Here is the code from earlier, written in the programming language, C.

So it's just that tiny little bit int c= a + b and then a semicolon.

The line of code is four lines long in assembly language.

So look how many lines it takes up and it's also four lines long in machine code.

So, high-level languages are easier for computers to understand.

Is that true or false? It's false.

C is a high-level programming language, is that true or false? It's true.

High-level languages can be translated using a compiler or an interpreter.

A compiler will create a single executable file that can be then run without the original source code.

An interpreter will run the source code one line at a time and doesn't create an executable file.

The interpreter is needed every time you run the code.

So if you've ever made a Scratch programme, then you'll have used a programme that uses an interpreter because you need Scratch to be able to run those programmes.

So, a compiler will create a single, executable file, is that true or false? It's true.

Imagine that you have been given a cake recipe that has been written in a language that you don't understand.

So this one has been written in Greek, for example.

To help you follow the recipe, you are going to need to translate the instructions.

Your first option is to compile those instructions.

This means that you can create a fully translated version of the recipe that you can use whenever you need to.

This might take some time, but once created, you no longer need the original recipe.

It would be much quicker to follow it each time.

You could easily share your translated recipe with other friends who speak the same language.

Your second option is to have an interpreter follow the recipe with you.

The interpreter would translate each line of the recipe individually whilst you bake your cake.

This would be quick to do initially, but you would always need an interpreter when you wanted to follow that recipe.

Also, if you wanted to share the recipe with your friends, then they would also need an interpreter to follow the recipe.

Interpreters and compilers are necessary for programmers because they allow us to write programmes in formal, structured English, and translate them.

High-level languages only exist because of translators.

Without translators, our only option would be to write in machine code.

High-level languages made programming more accessible to a wider audience.

Here we go then, some more true or false.

Assembly language and machine code use the same number of lines of code.

Do they? Yes they do.

Grace Hopper invented the first compiler.

Yes she did.

Translators are used to translate high-level languages into machine code.

Yes they do.

And that's everything for this lesson.

So that's just your introduction into those, some of those key words like translators, compilers, interpreter, assembly language, it's quite a lot of new words there.

So, if you didn't quite catch them all, it might be worth watching the video again and pausing and making notes using your pen and paper so that you really got a good grasps of what those key words are.

And the next lesson, in lesson two we're going to start exploring a programming language ourself and the programming language is Python.

So you'll be able to see there how actually programming languages work and get started yourself.

So I hope you looking forward to that.

I'll see you soon for lesson two.