Levels of Programming Languages (OCR GCSE Computer Science): Revision Notes
📚 Revision Notes
Levels of Programming Languages
Programming languages are categorised into high-level and low-level languages based on their characteristics and their closeness to machine code.
Low-Level Languages
Low-level languages are closer to machine code, which is the binary code understood by a computer's CPU.
Machine Code
- Description: Binary code that directly controls a CPU's operations.
- Characteristics:
- Processor-specific (each processor type has its own machine code).
- Executed directly by the hardware without needing translation.
- Written in binary (1s and 0s).
- Example:
10101010could be a binary instruction specific to a CPU.
Assembly Code
- Description: A low-level programming language that uses mnemonics (short abbreviations) to represent machine code.
- Characteristics:
- Easier to understand than machine code.
- Processor-specific, just like machine code.
- Commonly used in embedded systems.
- Requires an assembler to be converted into machine code.
- Example:
LDA(Load),STA(Store) are examples of assembly code instructions.
High-Level Languages
High-level languages are closer to human languages and are abstracted from machine code.
- Description: These languages use commands that resemble structured English and are designed to be easy to read and write for humans.
- Characteristics:
- Machine-independent (can be used across different systems).
- Requires a compiler or an interpreter to translate into machine code.
- Easier to debug and maintain compared to low-level languages.
- Examples include Python, Java, C++, JavaScript, and C#.
Differences Between High-Level and Low-Level Languages
| Feature | Low-Level Languages | High-Level Languages |
|---|---|---|
| Closeness to Machine | Very close (binary or mnemonics) | Far from the machine, close to human |
| Portability | Machine-specific | Portable across different systems |
| Ease of Understanding | Hard to learn | Easy to understand (resembles English) |
| Memory Efficiency | More memory efficient | Less memory efficient |
| Execution Speed | Faster (no need for translation) | Slower (requires translation) |
| Direct Hardware Access | Can manipulate hardware directly | Limited direct hardware access |
Advantages and Disadvantages
| Low-Level Languages | High-Level Languages |
|---|---|
| Advantages | Advantages |
| Uses less memory | Easier to learn and write |
| Executes faster | More readable and maintainable |
| Allows direct control of hardware | More portable across different systems |
| Disadvantages | Disadvantages |
| Hard to learn and understand | Slower execution due to the translation |
| Harder to debug and maintain | Requires more memory |
| Specific to one machine |
infoNote
Key Points to Remember
- Low-Level Languages are closer to the machine and are used when memory efficiency and speed are paramount, but they are harder to learn and maintain.
- High-Level Languages are user-friendly, easier to write and debug, and portable across systems, though they are slower in execution and less efficient with memory.