- [Craig] In this video, we explore the difference between high-level and low-level languages.
Programming dates back to the very dawn of computer science.
Better described as electronic adding machines,
computers were originally controlled by a web of large electrical cables
and programmed by combinations of plugboard and wiring.
Number of wires had to be plugged for each single instruction of a problem,
thousands of them for each program, and this took several days to set up.
Typically, programs were changed only once every few weeks due to the complexity involved.
Later plug boards were permanently programmed
with a repertoire of between 50 to 100 commonly used instructions
that could be entered as a sequence of instructions.
Typically, programs are written in binary on paper tape.
This is clearly extremely difficult for programs to write because using zeros and ones is very complicated,
and therefore, a new method of writing code needs to be found.
Low-level languages such as assembly were developed
which allowed programmers to express programs using simple commands
which could be easily translated into the machine code.
These languages closely mapped to the machine architecture being written for a specific processor
and this is sometimes described as being close to the hardware.
The limited speed and memory capacity of early computers
forced programmers to write hand-tuned assembly language programs.
However, working with the memory directly made them incredibly efficient.
It was eventually realised that programming in assembly language
required a great deal of intellectual effort, as the code was hard to both understand and to write.
Short code, proposed in 1949, was one of the first high-level languages ever developed for an electronic computer.
Unlike machine code, short code statements represented mathematical expressions in an understandable form.
However, the program had to be translated into machine code every single time it ran,
making the process much slower than running the equivalent machine code.
As central processing units became faster and memory capacity increased,
there was less need to interact with the hardware directly,
and the growth of different high-level programming languages for different purposes exploded over the next 60 years.
In personal computers, assembly was still used to create games
because code needed to execute quickly and use memory very efficiently,
whereas other programs where speed was not so critical
could be programmed in high-level languages such as Basic.
Today, almost all programs are written in high-level languages
such as Python, C in its many flavours, Lure and Java to name a few.
Assembly language is still used today but it tends to be reserved for specialist situations
such as creating code for embedded systems and device drivers.
So here's a quick recap.
Machine code is the binary representation of instructions in a format the CPU can decode and execute.
We have an operation code, an opcode instruction and an address or data to use the operand.
Low-level languages are written in assembly language.
They're translated by an assembler into machine code.
They're typically used these days for embedded system and device drivers
where instructing the hardware directly is necessary.
One instruction is translated into one machine code instruction.
The code works on only one type of processor.
The programmer works with a memory directly.
The code is harder to write and understand but is very memory-efficient and very fast to execute.
High-level languages are written in source code
in languages such as Python, C, Java and Visual Basic.
It's translated by a compiler or an interpreter into machine code.
It makes writing of the computer program easier by using commands which are like English.
One source code instruction can translate into many machine code instructions,
and the code will run on different types of processors.
The programmer has lots of data structures to use,
and the code is much quicker to write and easier to understand.
It is less memory-efficient, and the code can be slower to execute if it's not optimized well.