Event driven programming is a core exam topic in Unit 1. You need to understand the paradigm, how it works, its structure, where it is used and the implications of building software this way. This tutorial covers exactly what you need for distinction-level answers.
Event driven programming is a style where the program does nothing until something triggers it. That “something” is an event. Instead of running line by line like procedural code, event driven programs sit idle, wait for input and react.
This is how nearly all GUI apps, mobile apps and system tools work. Everything from a button click to a timer firing is an event that starts a piece of code.
Users do not want to follow a strict sequence. They want to click what they want, when they want. Event driven design makes this possible. The program responds to actions rather than controlling the flow.
It also allows the system itself to trigger behaviour, like alarms, timers or warnings.
These terms come up repeatedly in the exam:
Main Loop
The program’s heartbeat. It constantly runs in the background, listening for events. It never stops until the program ends.
Event Loop
A specific loop that monitors events. It checks for user actions or system signals and sends them to the right handler.
Listeners
Processes that wait for specific events. Example: waiting for a click on a button.
Event Handlers (Callbacks)
Functions that run when an event occurs. Each event typically has its own handler. Modular and easier to debug.
Trigger Functions
The glue between the event and the handler. When the event fires, the trigger calls the correct handler automatically.
Subroutines
Event handlers are usually subroutines. Each one handles one specific job.
These are all examinable.
These are the key features examiners expect you to mention:
Events
User or system actions. Examples: typing, clicking, keypress, low battery, incoming data.
Event Handlers
Code that runs when an event happens.
Event Loops
Continuously waiting and listening. Uses CPU even when idle.
Time Driven Processing
Events triggered by time. For example, autosave every 5 minutes or batch processing overnight.
Service-Oriented Processing
The program reacts to services running in the background. Flexible but uses memory and CPU.
Event driven programming is everywhere in modern computing:
GUI applications
Mobile apps
Video games
Form-based systems
Anything interactive
Exam points:
Systems that handle unpredictable user input benefit from this model. Systems with fixed, predictable workflows do not.
Good event driven design provides:
High interactivity
Perfect for GUIs and user-controlled applications.
Modular code
Each event and handler is independent. Easier testing and debugging.
Efficient response to irregular input
Great for forms, data entry and real-time input.
Scalability
Adding new events is simple. New features can be slotted in without touching old code.
You need to know the limits:
Complex design
GUIs and event flows get complicated fast.
Hidden errors
If an event is rarely triggered, bugs sit there until someone hits that specific path.
Constant CPU usage
The event loop never stops listening.
Not ideal for simple tasks
For jobs that should run in a fixed order, procedural code is easier.
This means linking the program to background services.
Pros:
Interacts with other systems cleanly.
Can run automated tasks.
Cons:
Consumes RAM and CPU even when “idle”.
Not worth using if the program only runs occasionally.
Useful for scheduled events:
Timed backups
Autosave
Periodic updates
Batch processing overnight
This is still event driven, just triggered by time instead of user action.
Procedural:
Runs top to bottom in a fixed sequence.
Object Oriented:
Organised around objects and classes.
Event Driven:
The flow is triggered by events. The user or system controls what happens next, not the code structure.
You will almost always gain marks by comparing these in answers.
You understand:
What events, loops, handlers and callbacks are
Why programs need a main loop
Where event driven systems are used
Advantages and drawbacks in real contexts
Differences from other paradigms
Examples of time driven and service oriented processing
When event driven programming is appropriate and when it isn’t
If you can explain all of this clearly, you are covering the full scope of the topic at a distinction level.
Create a customised learning path powered by AI — stay focused, track progress, and earn certificates.
Build Your Learning Path →