Programming Languages Classification
There are hundreds of programming languages, but they all serve as a bridge between human logic and machine execution. In this lesson, we classify them by their level of abstraction and their programming paradigm.
Learning Objectives
- 11.5.1.1 Classify programming languages into low-level and high-level languages
- 11.5.1.2 Compare high-level and low-level programming languages
- 11.5.1.3 Compare imperative and declarative programming languages
Conceptual Anchor
The Ladder of Abstraction
At the absolute bottom, a CPU only understands Machine Code (binary `1`s and `0`s). Humans understand English and mathematical logic. Programming languages act as a ladder. The higher you go up the ladder, the closer the language looks to human English (High-Level). The lower you go, the closer it looks to raw hardware binary (Low-Level).
High-Level vs. Low-Level Languages
Classification List
Based on the syllabus, here is how common languages are classified in terms of abstraction:
Low-Level Languages
- Assembly Language (Uses mnemonics like `ADD`, `LDA`)
- C (Often classified as mid/low-level because it provides direct memory access via pointers, making it ideal for hardware)
High-Level Languages
- Python
- Java
- C++
- Ruby
- JavaScript
- PHP
Comparison Table
| Feature | High-Level Languages (HLL) | Low-Level Languages (LLL) |
|---|---|---|
| Readability & Usability | Easy to read, write, and maintain. Closer to human language. | Hard to read and write. Closer to machine code (binary/mnemonics). |
| Hardware Control | Abstracted. The programmer does not manage CPU registers directly. | Absolute control over CPU registers, memory addresses, and hardware. |
| Speed of Execution | Slower. Code must be heavily translated (compiled/interpreted). | Extremely fast and memory-efficient. Minimal translation needed. |
| Portability | Highly portable. Can run on different OS and hardware (e.g., JVM). | Machine-dependent. Assembly written for an ARM chip won't work on Intel. |
| Application Areas | Web development, data science, desktop apps, enterprise software. | Device drivers, embedded systems (e.g., microwaves), operating system kernels. |
Imperative vs. Declarative Paradigms
A Programming Paradigm is a style or "way of thinking" about how to solve a problem with code. The two major approaches are Imperative and Declarative.
| Feature | Imperative Programming | Declarative Programming |
|---|---|---|
| Core Concept | Describes exactly HOW to achieve a result using a specific sequence of steps. | Describes WHAT result needs to be achieved, without detailing the steps. |
| Code Complexity | Code can be difficult to write, debug, and trace due to complex loops and states. | Code is usually shorter, easier to read, and easier to understand. |
| State Management | Programmer constantly modifies variables and manages the state of the program. | Stateless. The underlying engine decides how to fetch or build the result. |
| Language Examples | C, Java, Python, JavaScript | SQL, HTML, Prolog |
Worked Examples
1 Code Comparison: Filtering Data
Imagine we have a list of numbers, and we want to get only the numbers greater than 10.
results = []
for num in number_list:
if num > 10:
results.append(num)
print(results)SELECT num
FROM number_list
WHERE num > 10;Notice how in SQL we don't write a `for` loop. We just declare what data we want, and the database engine figures out how to fetch it.
Common Pitfalls
Is HTML a programming language?
HTML is technically a markup language, not a Turing-complete programming language. However, in the context of paradigms, it is the perfect example of Declarative syntax: you write `
Title
` to declare what you want, but you don't write the pixel-by-pixel rendering algorithm.Tasks
What am I looking at?
Instructions: Your teacher will project 4 different code fragments on the board. You have 30 seconds per fragment to independently identify in your notebook if it is High-Level, Low-Level, Imperative, or Declarative. Write down a brief justification pointing out specific syntax (e.g., SELECT, LDA, for i in range).
Pick the Right Tool
Instructions: Working independently, decide whether a High-Level or Low-Level language is better for the following projects, and write down your reasoning:
1. Writing the firmware for a smart microwave.
2. Developing a new social media web application.
3. Creating a device driver for a new graphics card.
The Speed vs Readability Trade-off
Instructions: Low-level languages are incredibly fast, yet 95% of modern developers use high-level languages like Python or JavaScript. Write a short paragraph explaining why tech companies prefer to sacrifice execution speed in favor of code readability and portability.
Formative Assessment
Q1: In what specific situations are low-level languages fundamentally required?
Q2: Classify the following languages as Imperative or Declarative: Python, Prolog, Java, SQL.
Declarative: Prolog, SQL.
Q3: Why is debugging usually more difficult in low-level languages?