Loading...
Hello.
My name is Mrs. Holborow, and welcome to Computing.
I'm so pleased you've decided to join me for the lesson today.
In this lesson, we'll look at how computers run code and we'll compare low and high-level programming languages.
Welcome to today's lesson from the unit Programming Sequence.
This lesson is called High and Low-level Languages, and by the end of today's lesson, you'll be able to explain the differences between low-level and high-level programming languages and how they interact with hardware.
Shall we make a start? We will be exploring these keywords throughout today's lesson.
Low-level language.
Low-level language, programming languages that require the programmer to use terms that are aligned to the operations of a specific machine.
High-level language.
High-level language, a human-readable language written in formal structured English.
Compiler.
Compiler, creates an executable file for a programme by translating a high-level language to machine-readable code.
Interpreter.
Interpreter, translates and executes code line by line, then translates it into machine-readable code.
Today's lesson is split into three parts.
We'll start by explaining how computers run code as it is written.
We'll then identify features of low-level languages, and then we'll go on to explain how high-level languages simplify code.
Let's make a start by explaining how computers run code as it is written.
Humans will make assumptions when given instructions, which will usually get them the right result.
However, computers need precise instructions, because they can't make assumptions like humans.
Fill in the gap to complete the sentence.
Computers need when developing programmes for it to run.
That's right.
Computers need precise instructions when developing programmes for it to run.
A computer will run the instructions.
It cannot misinterpret an instruction like a human can.
It also can't try to guess what the instructions mean and figure it out like a human can.
If a computer does something unexpected, then it's because the human that programmed the computer wasn't precise enough with their instructions.
You could instruct a computer to draw a square.
One, draw a line.
Two, turn the drawing direction by 90 degrees, draw another line of the same length.
Turn the drawing direction by 90 degrees.
Draw another line of the same length.
Turn the drawing direction by 90 degrees.
Finish by drawing another line of the same length.
If the instructions in your programme are incorrect, the computer will still run them.
For example, if line six in the set of instructions had incorrectly instructed the computer to turn the drawing direction by 95 degrees instead of the correct 90 degrees, the result is an incorrect answer.
It's not a square.
Time to check your understanding.
If a computer programme contains an incorrect instruction, what will the computer do? A, refuse to run the instruction.
B, try to guess what the instruction should be.
Or C, run the instruction as it is written, even if it's wrong.
Pause the video whilst you have a think.
Did you select C? Well done.
If a computer programme contains an incorrect instruction, then it will still run that instruction as it is written, even if it's wrong.
Okay, for the first activity of today's lesson, I'd like you to explain why computers need very precise instructions unlike humans.
What might happen if the instructions are not precise? Pause the video whilst you complete the activity.
How did you get on? Let's have a look at a sample answer together.
Computers usually run code line by line following the exact order of the instructions.
Computers can't make assumptions or guess what you mean, like humans can.
If the instructions are not precise, the computer might do something unexpected or produce the wrong result.
Okay, we're now moving on to the second part of today's lesson where we're going to identify features of low-level languages.
Low-level languages are programming languages that provide direct control over hardware.
They are difficult to read, but are efficient for system programming.
Low-level languages are close to machine code.
Instructions are written in a way that the computer's processor can execute directly.
Machine code is the lowest level programming language that a computer can run directly.
It consists of binary instructions, zeros and ones, that the central processing unit, or CPU, understands.
Different CPUs have different machine code instructions.
Which of these is a characteristic of low-level programming languages? Is it A, they provide direct control over the computer's hardware, B, they are not very efficient for system programming, or C, they're easy for humans to read and understand? Pause the video whilst you have a think.
Did you select A? I knew you would, well done.
Low-level programming languages provide direct control over the computer's hardware.
In low-level languages, programmes run quickly, because they interact directly with the hardware.
Low-level languages require programmers to manage memory and hardware directly.
Complex syntax makes it harder to learn and debug compared to high-level languages.
Low-level languages though are ideal for writing operating systems, device drivers and embedded systems. Which of these is a potential drawback of using a low-level programming language for programming? Is it A, programmes written in low-level languages tend to run very slowly? B, low-level languages require programmers to manage memory and hardware details, which can be complex.
Or C, low-level languages are not suitable for writing operating systems or device drivers.
Pause the video whilst you have a think.
That's right.
The correct answer is B.
Low-level languages require programmers to manage memory and hardware details, which can be complex.
Okay, we're moving on to the second task of today's lesson now, and you're doing a great job so far, so well done.
Give an example of a situation where it would be appropriate to use a low-level language for programming.
Why would a low-level language be useful in this situation? Pause the video whilst you complete the activity.
Let's have a look at a sample answer together.
A low-level language would be appropriate for developing a new operating system for a computer.
Operating systems need to manage and control all the hardware components of a computer, such as the processor, memory and storage.
Low-level languages provide the control needed to programme these directly.
Operating systems need to be very efficient to ensure the computer runs smoothly.
Low-level languages allow programmers to write code that uses minimal resources and run quickly.
Remember, if you need to pause the video here and go back and add any detail to your answer, you can do that now.
Okay, we're moving on to the final section of today's lesson where we're going to explain how high-level languages simplify code.
Writing code with low-level languages is time-consuming, because it's hard to read, debug, and maintain.
Grace Hopper, a pioneering early computer scientist, said, "Data processes ought to be able to write their programmes in English, and the computers would translate them into machine code." High-level languages could write one line of plain English code that would then be translated to lots of lines of assembly language.
Let's have a look at an example.
So here we have some code written in Python.
C is equal to A plus B.
The same code written in assembly language looks like this, far more complicated and difficult to write.
High-level languages could write one line of plain English code that could then be translated into four lines of machine code.
Let's have a look at that same example of our Python code.
So remember, C is equal to A plus B.
The same code written in machine code looks like this.
We'd have to remember a lot of zeros and ones to code this correctly.
Time to check your understanding.
How do high-level languages improve the efficiency of writing code compared to low-level languages? Is it A, they allow programmers to write one line of code that can be translated into many lines of machine code, B, they make it more difficult to read and understand the code, or C, they require programmers to manage memory and hardware directly? Pause the video whilst you have a think.
That's right.
High-level languages allow programmers to write one line of code that can be translated into many lines of machine code.
Great work.
High-level languages can be translated using a compiler or an interpreter.
A compiler will create a single executable file that can be run without the original code.
An interpreter will run the code one line at a time and doesn't create an executable file.
The interpreter is needed every time you run the code.
Imagine that you have been given a cake recipe that has been written in a language you don't understand.
To help you follow the recipe, you're 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 may take some time, but once it's created, you no longer need the original recipe.
It would then be much quicker to follow each time.
You could even 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, they would also need an interpreter to follow the recipe.
What is the main difference between a compiler and an interpreter? A, a compiler translates code into machine code all at once whilst an interpreter translates it line by line, B, a compiler is easier to use while an interpreter is more difficult, or C, a compiler is used for web development where an interpreter is used for game development? Pause the video whilst you have a think.
That's right.
A compiler translates code into machine code all at once, whereas an interpreter translates it line by line.
Interpreters and compilers are necessary for programmers, because they allow us to write programmes in normal 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.
Okay, we're moving on to our final set of tasks for today's lesson, and you've done a great job so far, so well done.
For part one, explain how high-level languages simplify code for programmers.
For part two, what role do compilers and interpreters play in this simplification? Pause the video whilst you have a go at the activity.
How did you get on? Let's have a look at some sample answers together.
For part one, you were asked to explain how high-level languages simplify code for programmers.
High-level languages make coding simpler by letting programmers use words and commands that are closer to human language, making it easier to read and write.
For part two, what role do compilers and interpreters play in this simplification? Compilers and interpreters translate high-level languages into machine code that computers can understand.
Compilers translate the whole programme at once while interpreters translate it line by line as it runs.
Remember, if you need to add any detail to your answers, you can pause the video now.
Okay, we've come to the end of today's lesson and you've done a fantastic job, so well done.
Let's summarise what we've learned together.
Computers execute the instructions in programmes and code exactly as written without any interpretation.
Low-level languages allow programmers to directly control computer hardware, giving them precise command over the machine's components.
High-level languages hide the complex details of the computer's hardware, making the code more human-readable and easier to understand.
Compilers and interpreters are used to translate high-level languages into instructions that the computer can execute.
I hope you've enjoyed today's lesson and I hope you'll join me again soon.
Bye.