Unit 11.1A · Term 1

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, generations, 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

Lesson Presentation

11.1A-programming-languages.pdf · Slides for classroom use

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

A visual spectrum showing Machine Code at the bottom, Assembly in the middle, and High-Level Languages like Python at the top.
Figure 1: The spectrum of programming languages from hardware to human-readable code.

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.

Generations of Programming Languages

A visual structure showing generations from 1GL at the hardware base to 5GL at the human logic level.
Figure 2: As generations progress from 1GL to 5GL, they move further from machine architecture and closer to human logic and natural language.
Generation Type & Examples Definition (What is it?) Purpose (Why is it needed?) Application (Where is it used?)
1GL Machine Code
(Binary `0`s and `1`s)
Low-level code executed directly by the CPU without translation. Provides direct hardware communication at the transistor level. Currently generated by compilers; no longer written manually.
2GL Assembly Language
(Mnemonics like `ADD`)
Low-level language replacing binary with readable commands. Requires an assembler. Improves readability while maintaining absolute control over registers and memory. Device drivers, embedded systems, OS kernels.
3GL High-Level Imperative
(Python, Java, C++)
Language with understandable syntax (variables, loops), abstracted from hardware. Significantly speeds up development, ensures readability and portability. Application software, web development, enterprise systems.
4GL Declarative / Domain-Specific
(SQL, HTML)
Language where the programmer describes the result, not the step-by-step algorithm. Maximizes simplicity for highly specialized domain tasks. Database querying (SQL), interface markup.
5GL Logic / AI
(Prolog, LISP)
Language based on facts, rules, and logical constraints. Solves complex problems without procedural algorithms (the system deduces the answer). Expert systems, logic programming, AI research.

Imperative vs. Declarative Paradigms

Illustration comparing Imperative (step-by-step cooking instructions) to Declarative (ordering a finished meal from a menu).
Figure 3: Imperative is "How to do it", Declarative is "What I want".

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.

Imperative (Python): HOW
results = [] for num in number_list: if num > 10: results.append(num) print(results)
Declarative (SQL): WHAT
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

Analyze (Visual Code Recognition)

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).

Apply (Scenario Sorting)

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.
4. Writing a complex database query to extract specific user records. (Hint: Think generations / 4GL).

Evaluate (Written Reflection)

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.

Challenge (Beyond the Obvious)

Find the Architectural Flaw

Instructions: Read the following statement: "Since 3GLs (like Python) are highly portable and easy to read, they will soon completely replace 2GLs (Assembly)."
Find the architectural flaw (edge case) in this assumption. Explain why 2GL will always remain irreplaceable in certain environments (e.g., medical pacemaker microcontrollers).

Formative Assessment

Q1: In what specific situations are low-level languages fundamentally required?

When writing software that must interact directly with the hardware without an operating system in the way, such as embedded systems (appliances), bootloaders, and device drivers.

Q2: Classify the following languages as Imperative or Declarative: Python, Prolog, Java, SQL.

Imperative: Python, Java.
Declarative: Prolog, SQL.

Q3: Why is debugging usually more difficult in low-level languages?

Because the code relies on manipulating memory addresses and hardware registers directly using abstract mnemonics, lacking human-readable variables, loops, and built-in error handling.

Q4: Trace the execution portability. If you write a sorting algorithm in 2GL and 3GL, what happens when you try to run both on a completely different CPU architecture?

The 2GL code will fail completely because Assembly is machine-dependent. The 3GL code will execute successfully, provided the target system has the appropriate compiler or interpreter installed to translate it.