20 min read
The Evolution of Programming Languages
From machine code and assembly language to high-level languages — the generations of languages and why they changed.
Machine Code (First Generation)
The CPU only understands machine code: instructions written in binary, such as 10110000 01100001. Each type of processor has its own machine code. Early programmers wrote programs directly in binary (or in hex).
- Advantages: runs directly on the CPU; very fast; no translation needed.
- Disadvantages: almost impossible for people to read or write; easy to make mistakes; works only on one type of processor.
Assembly Language (Second Generation)
Assembly language replaces binary codes with short words called mnemonics, such as LDA (load), ADD, STO (store) and JMP (jump), and lets programmers use names for memory locations. Each assembly instruction matches one machine-code instruction.
Assembly language (like the fetch–execute example in the Hardware course)Text
LDA 5 ; load the value at address 5 into the accumulatorADD 6 ; add the value at address 6STO 7 ; store the result at address 7HLT ; stopAssembly is still used where speed and direct hardware control matter: device drivers, parts of operating systems and small embedded controllers.
High-Level Languages (Third Generation onwards)
High-level languages use English-like words and maths symbols. One line may become many machine instructions. They are portable: the same program can run on different computers after translation.
The same kind of task in Python — a high-level languagePython
total = price * quantityif total > 5000: total = total * 0.9| Generations of programming languages | ||
|---|---|---|
Low-level vs high-level
| Low-level (machine code, assembly) | High-level (Python, Java, C) |
|---|---|
| Close to the hardware | Close to human language |
| Hard to learn, read and debug | Easier to learn, read and maintain |
| Tied to one type of processor | Portable between computers |
| Very fast, small programs | Needs translating; usually a little slower |
Practice
More lessons in Introduction to Programming · Next: Translators: Assemblers, Compilers and Interpreters · Previous: What Is a Program?
