Skip to content
MathsGenie logo
Quick links
Open app

Course home

  1. AS Level
  2. Computer Science OCR
  3. Revision guides

Types of Programming Language

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

Definition

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.

Diagram showing procedural, assembly, and object-oriented programming language types

Key Idea

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

TypeMain ideaOften useful for
ProceduralSolve the problem as a sequence of steps, split into procedures/functionsAlgorithms, data processing, small-to-medium programs
Assembly languageUse symbolic mnemonics close to machine codeEmbedded systems, hardware control, learning CPU behaviour
Object-orientedModel the system using objects that combine data and behaviourLarge systems, simulations, GUIs, maintainable applications
Common Mistake

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.

Example

Choosing a suitable language type

A company is choosing how to write different pieces of software.

  1. 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.
  2. 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.
  3. 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

Definition

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…next or while…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
Example

Tracing a total-calculation procedure

Suppose marks[0] = 12, marks[1] = 18, and marks[2] = 15.

  1. The function starts with total = 0, then the first loop pass uses i = 0, so marks[0] is added and total becomes 12.
  2. The second loop pass uses i = 1, so marks[1] is added and total becomes 30.
  3. The third loop pass uses i = 2, so marks[2] is added and total becomes 45; the loop ends and the function returns 45.

Assembly language and the Little Man Computer

Definition

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

MnemonicMeaning
INPInput a value into the accumulator
OUTOutput the value in the accumulator
LDALoad a value from memory into the accumulator
STAStore the accumulator value into memory
ADDAdd a memory value to the accumulator
SUBSubtract a memory value from the accumulator
BRABranch always
BRZBranch if the accumulator is zero
BRPBranch if the accumulator is zero or positive
HLTStop the program
DATReserve a memory location for data
Tip

Tracing LMC programs

For a dry run, track the current instruction, the accumulator, and any labelled DAT memory locations.

Example

Writing and following an LMC addition program

This program inputs two numbers and outputs their sum.

LabelInstructionPurpose
INPInput first number
STA FIRSTStore first number
INPInput second number
ADD FIRSTAdd the first number
OUTOutput the result
HLTStop
FIRSTDATStorage for first number
  1. The first number must be kept while the second number is entered, so the program stores it in the labelled memory location FIRST.
  2. After the second INP, the accumulator contains the second number; ADD FIRST uses the stored first number and adds it to the accumulator.
  3. If the inputs are 7 and 5, STA FIRST stores 7, the second INP loads 5, ADD FIRST makes the accumulator 12, and OUT outputs 12.

Modes of addressing memory

Definition

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.

Diagram showing immediate, direct, indirect, and indexed memory addressing modes

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.

Common Mistake

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.

Example

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.

  1. With immediate addressing, the value used is 20 because the operand itself is the data.
  2. With direct addressing, the processor looks at memory address 20, so the value used is 45.
  3. With indirect addressing, address 20 points to address 45, so the value used is the value stored at address 45, which is 9.
  4. 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

Definition

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 private and public
  • polymorphism: the same method call can run different method implementations depending on the object’s class
Common Mistake

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

Identifying OOP features in pseudocode

  1. Vehicle and Car are classes, while myVehicle and myCar are objects created using new.
  2. speed is an attribute and it is marked private, so this demonstrates encapsulation because outside code should not access it directly.
  3. Car inherits Vehicle, so Car is a subclass; both classes define description(), so a call to description() can behave differently for a Vehicle object and a Car object, demonstrating polymorphism.
Exam technique

In the exam

  1. When comparing paradigms, link the feature to the problem: maintainability for OOP, step-by-step clarity for procedural, hardware control for assembly.
  2. For LMC questions, trace the accumulator and labelled DAT locations carefully, especially before and after STA, ADD, SUB, BRZ, and BRP.
  3. For addressing modes, state exactly what the operand represents: value, address, address-of-address, or base address plus index.
Self review

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?
PreviousNext

How was this guide?

Teach Genie

Review Types of Programming Language by teaching Genie

Teach it back in your own words, spot gaps, and remember it better.

Start teaching
Genie and Baby Genie

Lesson

Recap your knowledge with an interactive lesson

8 minute activity

Start lesson

Comparison figure of procedural step-by-step flow, assembly memory and accumulator, and object-oriented classes and objects

A programming paradigm is a style for organising a program. No single style is best for every task, because different problems prioritise clarity, maintainability, performance, or direct hardware control.

High-level languages hide many hardware details so the programmer can focus on the problem. Low-level languages stay closer to the processor, memory, and machine instructions.

In this topic, the key types are procedural, assembly, and object-oriented. A language can support more than one paradigm, so a paradigm is the style you use rather than just the language name.

Flashcards

Remember key concepts with flashcards

22 flashcards

Practice flashcards

A programming [     ] affects how you break down a problem, organise data, and control what happens next.

Types of Programming Language Revision Guide

  1. AS Level
  2. /Computer Science
  3. /Types of Programming Language

Revision guides