OOP models a program as a collection of objects.
Each object bundles:
An object is created from a class, which defines the structure (variables) and capabilities (methods) that all its objects share.
| Concept | Definition (syllabus wording) | How it is realised in Python |
|---|---|---|
| Encapsulation | Bundling of data and the methods that manipulate that data, with access control that hides the internal implementation. | Prefix instance variables with an underscore (e.g. _balance) and provide public getter/setter methods. Python does not enforce strict access modifiers, but the convention signals “private”. |
| Inheritance | Mechanism by which a new class (sub‑class) automatically acquires the attributes and methods of an existing class (super‑class). | Define the subclass with the parent class in parentheses, e.g. class Car(Vehicle):. Use super().init(...) to initialise the super‑class. |
| Polymorphism | Ability for a single interface to represent different underlying forms; the same method call can invoke different method bodies. | Method overriding in a subclass (dynamic dispatch). Python also supports overloading through default arguments or *args/**kwargs. |
| Abstraction | Providing a simplified model of a complex real‑world entity by exposing only essential features. | Use abstract base classes from the abc module or define a class that only specifies method signatures (no implementation). |
class Vehicle:"""Encapsulated state + basic behaviour for all vehicles."""
def init(self, make: str, year: int):
self._make = make # “private” attribute
self._year = year
def start(self) -> None:
print("Engine started")
# accessor (getter)
def get_make(self) -> str:
return self._make
class Car(Vehicle):
"""Car inherits from Vehicle and overrides start()."""
def init(self, make: str, year: int, doors: int):
super().init(make, year) # initialise Vehicle part
self._doors = doors
def start(self) -> None: # polymorphic method
print("Car ignition")
def get_doors(self) -> int:
return self._doors
Procedural programming treats a program as a sequence of instructions grouped into procedures (also called functions or sub‑routines). Data and code are separate: variables are typically global or have block scope, and the flow of control is explicit (loops, conditionals, calls).
# reusable functiondef maxoftwo(a: int, b: int) -> int:
return a if a > b else b
def main() -> None:
x = 5
y = 9
greatest = maxoftwo(x, y) # call the procedure
print(f"Greatest = {greatest}")
if name == "main":
main()
import).Functional programming treats computation as the evaluation of pure functions. A pure function has no side‑effects and always returns the same result for the same arguments. Data is immutable, and functions are first‑class values – they can be passed as arguments, returned from other functions, and stored in variables.
# pure function – no side‑effectsdef square(x: int) -> int:
return x * x
# higher‑order function: map applies a function to every element
numbers = [1, 2, 3, 4]
squares = list(map(square, numbers)) # [1, 4, 9, 16]
# recursion example – factorial
def factorial(n: int) -> int:
if n == 0:
return 1
return n * factorial(n - 1)
map or filter).Execution is driven by events such as user actions, sensor input or messages. A program registers event handlers (callback functions) that are invoked when the corresponding event occurs.
import tkinter as tkdef on_click():
print("Button pressed")
root = tk.Tk()
btn = tk.Button(root, text="Press me", command=on_click)
btn.pack()
root.mainloop()
Instead of specifying *how* to achieve a result, the programmer states *what* the result should be. Examples include SQL (what data to retrieve) and HTML/CSS (what a page should look like).
| Aspect | Object‑Oriented | Procedural | Functional | Event‑Driven / Declarative |
|---|---|---|---|---|
| Primary abstraction | Objects (state + behaviour) | Procedures / functions | Pure functions & immutable data | Events & callbacks / statements of *what* to achieve |
| Data handling | Encapsulated, access‑controlled | Variables with global or block scope | Immutable values | Data supplied by external sources (e.g., UI events) |
| Reuse mechanism | Inheritance, composition, interfaces | Modular functions, libraries | Higher‑order functions, function composition | Reusable event handlers, declarative templates |
| Polymorphism | Method overriding / overloading | None (except via function pointers) | Function composition, first‑class functions | Multiple handlers can respond to the same event type |
| Typical use‑cases | Large, evolving systems; GUI applications; simulations | Simple scripts, system utilities, low‑level code | Mathematical modelling, data transformation, concurrent processing | User‑interface programs, web front‑ends, configuration‑driven systems |
map (Functional)| Syllabus Domain | What to Verify in the Notes | Typical Gaps & How to Fix Them |
|---|---|---|
| 1. Information Representation (binary, BCD, ASCII/Unicode, hexadecimal, two’s‑/one’s‑complement, overflow) | • All number‑base conversions illustrated with worked examples. • Binary arithmetic shown step‑by‑step. • ASCII/Unicode discussion includes why code‑points matter. | *Missing overflow examples* → add a short table showing what happens when an 8‑bit addition exceeds 255. *No BCD* → insert a real‑world BCD use‑case (e.g., digital clocks) with a conversion example. |
| 2. Multimedia (Graphics & Sound) & Compression | • Bitmap vs. vector encoding, colour‑depth calculations, sampling‑rate impact on sound size. • Lossy vs. loss‑less methods (RLE, JPEG, MP3) with justification scenarios. | *Only bitmap shown* → add a simple vector‑graphic diagram and note when vectors are preferred. *Compression* → include a side‑by‑side file‑size table for a text, an image and an audio file before/after RLE and a lossy method. |
| 3. Communication & Networks | • LAN/WAN characteristics, topologies, client‑server vs. peer‑to‑peer, thin/thick client. • Ethernet/CSMA‑CD, IP addressing (IPv4/IPv6, subnetting, public vs. private, static vs. dynamic), DNS, URL structure, cloud concepts. | *Subnetting omitted* → add a simple subnet mask calculation (e.g., /24 to 255.255.255.0). *Cloud* → give a concrete example contrasting SaaS with IaaS. |
| 4. Hardware & Logic | • CPU Von‑Neumann model, registers (PC, MAR, MDR, ACC, IX), ALU, CU, clock, bus types, fetch‑execute cycle, interrupts. • Logic gates (AND, OR, NOT, NAND, NOR, XOR) truth tables, circuit construction, Boolean algebra, Karnaugh maps, flip‑flops, half/full adders. | *Interrupts rarely covered* → insert a diagram of an interrupt service routine flow. *K‑maps* → provide a 2‑variable example to illustrate minimisation. |
| 5. Processor Fundamentals | • Assembly language concepts, addressing modes, two‑pass assembler, sample instruction set, bit‑shifts, masking, simple programs traced step‑wise. | *Addressing‑mode table missing* → add a concise table (immediate, direct, indirect, indexed, relative) with a Python‑style pseudo‑code illustration. |
| 6. System Software | • OS purposes, management tasks (memory, file, process, I/O), security basics, virtualisation, utility software. | *No mention of virtual machines* → insert a brief note on how a JVM exemplifies OS‑level abstraction. |
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.