What you'll learn
- Why different programming languages and programming paradigms exist.
- How procedural, assembly, and object-oriented languages organise programs.
- How to follow and write simple Little Man Computer (LMC) programs.
- How immediate, direct, indirect, and indexed addressing find data in memory.
Why different programming paradigms exist
Programming paradigm
A programming paradigm is a style or model for designing programs. It affects how you break down a problem, organise data, and control what happens next.
No single language style is best for every task. A tiny embedded system may need close control of hardware, while a large booking system may need code that is easy to extend and maintain.
A high-level language hides many hardware details so the programmer can focus on the problem. A low-level language is closer to the processor’s actual instructions and memory.

Why variety matters
Different paradigms help with different priorities: clarity, reuse, maintainability, performance, memory control, or direct hardware access.
Common language types in this topic
| Type | Main idea | Often useful for |
|---|---|---|
| Procedural | Solve the problem as a sequence of steps, split into procedures/functions | Algorithms, data processing, small-to-medium programs |
| Assembly language | Use symbolic mnemonics close to machine code | Embedded systems, hardware control, learning CPU behaviour |
| Object-oriented | Model the system using objects that combine data and behaviour | Large systems, simulations, GUIs, maintainable applications |
Paradigm is not the same as language
A language can support more than one paradigm. For example, some languages can be used procedurally and object-orientedly.
Choosing a suitable language type
A company is choosing how to write different pieces of software.
- For a simple batch program that reads marks and calculates grades, a procedural approach fits well because the task is naturally a sequence of steps: input, calculate, decide grade, output.
- For a program controlling a small device with limited memory and direct hardware access, assembly language may be justified because it gives precise control over processor instructions and memory.
- For a large library system with books, users, loans, reservations, and fines, an object-oriented approach is suitable because those real-world entities can be modelled as interacting objects.
Procedural languages
Procedural language
A procedural language organises a program as a set of procedures or functions that carry out tasks step by step.
A procedure is a named block of instructions that performs a task. A function is similar, but returns a value. A parameter is a value passed into a procedure or function.
Procedural programming usually uses:
- sequence: instructions run in order
- selection: decisions using
if,elseif,else,endif - iteration: repetition using loops such as
for…nextorwhile…endwhile - top-down decomposition: breaking a large problem into smaller sub-problems
Example OCR-style pseudocode:
function totalMarks(byVal marks[3])
total = 0
for i = 0 to 2
total = total + marks[i]
next i
return total
endfunction
Tracing a total-calculation procedure
Suppose marks[0] = 12, marks[1] = 18, and marks[2] = 15.
- The function starts with
total = 0, then the first loop pass usesi = 0, somarks[0]is added andtotalbecomes 12. - The second loop pass uses
i = 1, somarks[1]is added andtotalbecomes 30. - The third loop pass uses
i = 2, somarks[2]is added andtotalbecomes 45; the loop ends and the function returns 45.
Assembly language and the Little Man Computer
Assembly language
Assembly language is a low-level language that uses mnemonic instructions instead of raw binary machine code.
A mnemonic is a short readable instruction name, such as LDA or ADD. An assembler translates assembly language into machine code, the binary instructions executed by the processor.
The Little Man Computer (LMC) is a simplified model of a computer used to practise assembly language. It has memory locations, an accumulator used for calculations, and a small instruction set.
LMC instruction set
| Mnemonic | Meaning |
|---|---|
INP | Input a value into the accumulator |
OUT | Output the value in the accumulator |
LDA | Load a value from memory into the accumulator |
STA | Store the accumulator value into memory |
ADD | Add a memory value to the accumulator |
SUB | Subtract a memory value from the accumulator |
BRA | Branch always |
BRZ | Branch if the accumulator is zero |
BRP | Branch if the accumulator is zero or positive |
HLT | Stop the program |
DAT | Reserve a memory location for data |
Tracing LMC programs
For a dry run, track the current instruction, the accumulator, and any labelled DAT memory locations.
Writing and following an LMC addition program
This program inputs two numbers and outputs their sum.
| Label | Instruction | Purpose |
|---|---|---|
INP | Input first number | |
STA FIRST | Store first number | |
INP | Input second number | |
ADD FIRST | Add the first number | |
OUT | Output the result | |
HLT | Stop | |
FIRST | DAT | Storage for first number |
- The first number must be kept while the second number is entered, so the program stores it in the labelled memory location
FIRST. - After the second
INP, the accumulator contains the second number;ADD FIRSTuses the stored first number and adds it to the accumulator. - If the inputs are 7 and 5,
STA FIRSTstores 7, the secondINPloads 5,ADD FIRSTmakes the accumulator 12, andOUToutputs 12.
Modes of addressing memory
Addressing mode
An addressing mode is the rule an instruction uses to interpret its operand and find the data it needs.
The operand is the value or address written after an instruction. The effective address is the actual memory address used after applying the addressing mode.

Immediate addressing
The operand is the actual value to use. For example, in generic assembly notation, LDA #7 means “load the value 7”.
Direct addressing
The operand is the address of the value. In LMC, LDA FIRST is direct addressing because FIRST is a label for a memory address.
Indirect addressing
The operand gives an address that stores another address. This is useful for pointers and flexible data structures.
Indexed addressing
The effective address is found by adding an index register to a base address. This is useful for arrays because the index selects an item.
Immediate versus direct
Immediate addressing uses the operand as the value itself. Direct addressing uses the operand as the address where the value is stored.
Finding the value used by each addressing mode
Suppose the operand is 20, the index register contains 3, memory address 20 contains 45, memory address 23 contains 7, and memory address 45 contains 9.
- With immediate addressing, the value used is 20 because the operand itself is the data.
- With direct addressing, the processor looks at memory address 20, so the value used is 45.
- With indirect addressing, address 20 points to address 45, so the value used is the value stored at address 45, which is 9.
- With indexed addressing, the effective address is 20+3=2320 + 3 = 2320+3=23, so the value used is the value at address 23, which is 7.
Object-oriented languages
Object-oriented language
An object-oriented language organises a program around objects that combine data with the methods that act on that data.
A class is a blueprint for objects. An object is an instance created from a class. An attribute is data stored by an object. A method is a procedure or function belonging to a class.
Object-oriented programming also uses:
- inheritance: a subclass receives attributes and methods from a superclass
- encapsulation: data and methods are bundled together, with access controlled using
privateandpublic - polymorphism: the same method call can run different method implementations depending on the object’s class
Class versus object
A class is the design. An object is the actual instance created from that design while the program is running.
Example OCR-style pseudocode:
class Vehicle
private speed
public procedure new(byVal startSpeed)
speed = startSpeed
endprocedure
public function description()
return "vehicle"
endfunction
endclass
class Car inherits Vehicle
public procedure new(byVal startSpeed)
super.new(startSpeed)
endprocedure
public function description()
return "car"
endfunction
endclass
myVehicle = new Vehicle(20)
myCar = new Car(60)
Identifying OOP features in pseudocode
VehicleandCarare classes, whilemyVehicleandmyCarare objects created usingnew.speedis an attribute and it is markedprivate, so this demonstrates encapsulation because outside code should not access it directly.Car inherits Vehicle, soCaris a subclass; both classes definedescription(), so a call todescription()can behave differently for aVehicleobject and aCarobject, demonstrating polymorphism.
In the exam
- When comparing paradigms, link the feature to the problem: maintainability for OOP, step-by-step clarity for procedural, hardware control for assembly.
- For LMC questions, trace the accumulator and labelled
DATlocations carefully, especially before and afterSTA,ADD,SUB,BRZ, andBRP. - For addressing modes, state exactly what the operand represents: value, address, address-of-address, or base address plus index.
Check yourself
- Why might assembly language be chosen instead of a high-level language?
- How are immediate, direct, indirect, and indexed addressing different?
- What is the difference between inheritance, encapsulation, and polymorphism?
