Advanced Programming II: Object-Oriented
Programming (OOP) Basics
Introduction:
Every time you open your bank's mobile app, check your MTN account balance, register on a school portal, or browse Jumia for a new phone — you are interacting with software that was almost certainly built using Object-Oriented Programming. This is not a coincidence. OOP has become the backbone of modern software development worldwide, and Nigeria is no exception.
Think about it this way: Lagos alone now hosts hundreds of tech startups. Companies like Flutterwave, Paystack, PiggyVest, and Andela have placed Nigeria firmly on the global tech map. The developers behind these groundbreaking products rely heavily on the principles you are about to learn in this lesson.
As a student of Computer Science under the Nigerian NERDC curriculum, understanding Advanced Programming II — specifically Object-Oriented Programming — is not just about passing your WAEC or NECO examination. It is about equipping yourself with a skill that employers, universities, and tech communities around the world genuinely value.
In this lesson, we will break OOP down in the simplest, most relatable way possible. By the time you finish reading, concepts like classes, objects, inheritance, and encapsulation will feel as familiar as the terms you use every day on your phone or in your classroom.
Learning Objectives (NERDC-Aligned)
By the end of this lesson, students should be able to:
Define Object-Oriented Programming and explain its significance in modern software development.
Identify and describe the four core principles of OOP: Encapsulation, Abstraction, Inheritance, and Polymorphism.
Distinguish between a class and an object, using real-life Nigerian examples.
Demonstrate how to write a simple class with attributes and methods using pseudocode or a programming language such as Python or Java.
Explain the advantages and limitations of using OOP in software design.
Apply ethical and responsible practices when designing and writing object-oriented programs.
What Is Object-Oriented Programming (OOP)?
Object-Oriented Programming — often shortened to OOP — is a style of programming that organises software around objects rather than functions or logic alone. An object is simply a self-contained unit that combines both data (what it knows) and behaviour (what it can do).
Before OOP became popular, most programs were written in a procedural style — meaning instructions were written one after another in a long list, like a recipe. This worked fine for small programs, but as software grew bigger and more complex, it became very difficult to manage. OOP was introduced as a cleaner, more organised way to build software.
Simple Analogy — Think of a University Imagine the University of Lagos (UNILAG). It has students, lecturers, courses, and departments. Each of these is an object. A student object knows its matric number, name, and department (data). It can also register for courses, pay fees, and print results (behaviour). OOP lets programmers model real-world things — like university systems — in a natural, organised way. |
Key Definition
Object-Oriented Programming (OOP) is a programming paradigm that uses 'objects' — instances of 'classes' — to design and build applications. It focuses on the concept of bundling related data and functions together into units called objects. |
Understanding Classes and Objects
What Is a Class?
A class is like a blueprint or template. It defines what an object will look like and what it can do — but it is not the object itself. Think of a class as the master design for something.
Real-Life Example: In Nigeria, the INEC voter registration form is a template. Every Nigerian voter fills out the same type of form. The form (template) is the class; each completed, submitted form belonging to a specific voter is an object.
What Is an Object?
An object is a specific instance created from a class. Once you use a class to create something real, that real thing is called an object. You can create many objects from one class, just as INEC can register millions of voters using the same registration template.
Another Example: Imagine a class called 'BankAccount'. This class defines that every bank account has an account number, an owner's name, and a balance. It also defines actions like deposit, withdraw, and check balance. Every customer at Access Bank, Zenith Bank, or GTBank has their own account object created from this BankAccount class.
# Python Example — Class and Object class BankAccount: def __init__(self, owner, balance): self.owner = owner self.balance = balance def deposit(self, amount): self.balance += amount # Creating objects (instances) chidi_account = BankAccount('Chidi Okonkwo', 50000) amaka_account = BankAccount('Amaka Eze', 120000) chidi_account.deposit(15000) # Chidi deposits N15,000 |
The Four Pillars of Object-Oriented Programming
There are four fundamental principles that define OOP. Every serious programmer needs to understand these. Think of them as the four walls of a building — remove any one of them and the structure begins to weaken.
1. Encapsulation — Keeping Things Safe and Private
Encapsulation means bundling data (attributes) and the methods (functions) that work on that data together inside a class — and then controlling who can access what. Some information is kept private; only specific methods are allowed to access or change it.
Nigerian Example: Your GTBank mobile app stores your PIN, account balance, and transaction history. This sensitive data is encapsulated — you cannot directly change your balance from outside the system. You can only access it through approved methods like 'transfer', 'deposit', or 'withdraw'. This protects your account from unauthorised changes.
Key Point: Encapsulation protects sensitive data. It hides internal details and only exposes what is necessary. |
2. Abstraction — Hiding Complexity, Showing Simplicity
Abstraction means showing only the essential features of something while hiding the complex details underneath. It is about simplifying the interface for the user.
Nigerian Example: When you use the USSD code *737# to check your UBA balance, you do not need to understand the complex database queries, server requests, or encryption happening behind the scenes. You just see your balance. That simplicity is abstraction at work.
In programming: When a developer uses a method called 'sendEmail()', they do not need to know exactly how email protocols work internally. The complexity is hidden — only the simple interface is exposed.
3. Inheritance — Building on What Already Exists
Inheritance allows a new class (called a child class or subclass) to take on the properties and methods of an existing class (called a parent class or superclass). This promotes code reuse and reduces repetition.
Nigerian Example: Think of a government staff record system. There is a general 'Employee' class with basic details like name, staff ID, and salary. You can then create more specific classes: 'Teacher', 'Doctor', and 'Engineer' — each of which inherits the basic Employee details but also adds its own unique properties (like 'Subject Taught' for a Teacher, or 'Specialisation' for a Doctor).
Class Type |
Inherits From |
Adds Its Own |
Employee (Parent) |
— |
Name, Staff ID, Salary |
Teacher (Child) |
Employee |
Subject, School |
Doctor (Child) |
Employee |
Hospital, Specialization |
Engineer (Child) |
Employee |
Field, Project |
4. Polymorphism — One Interface, Many Forms
Polymorphism comes from Greek words meaning 'many forms'. In OOP, it means different objects can be accessed through the same interface but behave in different ways.
Simple Example: Imagine a method called 'makePayment()'. If it is called on a POS machine object, it processes a card payment. If it is called on a mobile money object, it processes an Opay or PalmPay transaction. If it is called on a bank transfer object, it initiates an online transfer. Same method name — different behaviours depending on the object. That is polymorphism.
Attributes and Methods: The Building Blocks of a Class
Every class is made up of two things:
ATTRIBUTES (What it knows) |
METHODS (What it can do) |
These are variables that store data about the object. |
These are functions that define the object's behaviour. |
Example (Student): name, matric_number, department, GPA |
Example (Student): register_course(), pay_fees(), print_result() |
Constructors — The Object's Birth Certificate
A constructor is a special method that runs automatically when a new object is created. It sets up the object's initial data. In Python, the constructor method is called __init__. In Java, it shares the same name as the class.
Think of a constructor as the form you fill at a hospital when you first register as a patient. As soon as you register (create the object), your name, date of birth, and health record number are stored immediately. The constructor does exactly that for a new object.
Practical Applications of OOP in Everyday Nigerian Life
You might be wondering: where exactly is OOP being used in Nigeria right now? Here are some very real, very practical examples:
Fintech Applications: Paystack and Flutterwave use OOP to create objects like 'Transaction', 'Customer', 'Invoice', and 'Wallet'. Each transaction is an object with attributes like amount, sender, receiver, and timestamp, plus methods like process(), refund(), and verify().
Hospital Management Systems: Government hospitals like LUTH (Lagos University Teaching Hospital) use software with objects like 'Patient', 'Doctor', 'Appointment', and 'Prescription'. Inheritance is used to distinguish between 'InPatient' and 'OutPatient', both of which inherit from the general 'Patient' class.
School Portal Systems: JAMB's e-facility portal and university student portals are powered by OOP. Objects like 'Student', 'Course', 'Result', and 'Department' interact with each other to register students, record results, and generate transcripts.
E-Commerce: Jumia and Konga's platforms use OOP to manage objects like 'Product', 'Order', 'Seller', 'Customer', and 'Cart'. Every product listing is an object; every purchase creates a new Order object.
Government Systems: The National Identity Management Commission (NIMC) NIN database uses object-based design to store each citizen's identity as an object with unique attributes.
Advantages and Disadvantages of Object-Oriented Programming
Advantages
Reusability: Once a class is written, it can be reused many times. A school can use the same 'Student' class for SS1, SS2, and SS3 students without rewriting the code.
Scalability: OOP programmes are easier to scale — as your school portal grows from 200 students to 20,000, you simply create more Student objects; the class itself does not change.
Maintainability: Fixing a bug in one class does not break the rest of the programme, making maintenance much easier.
Real-World Modelling: OOP reflects the way humans naturally think about the world in terms of objects, relationships, and behaviours.
Security: Encapsulation protects sensitive data by restricting direct access to class attributes.
Team Collaboration: Large development teams can work on different classes simultaneously without interfering with each other's work.
Disadvantages
Complexity for Beginners: OOP can feel overwhelming at first, especially for students who are still learning programming basics.
More Memory Usage: OOP programmes can use more computer memory than simpler procedural programmes.
Longer Code: Sometimes, solving a simple problem using OOP requires more lines of code than a straightforward procedural approach.
Requires Strong Planning: Before writing code, you must carefully design your classes and their relationships. Poor planning leads to messy, confusing code.
Ethical and Safety Considerations in OOP Development
Learning to program comes with responsibility. When you build systems that store and manage people's data — like student records, patient information, or financial data — you must take ethics seriously.
Ethical Guidelines for Young Nigerian Programmers Data Privacy: Always use encapsulation to protect users' personal information. Never expose sensitive data publicly. Responsible Coding: Do not write programmes designed to steal data, crash systems, or harm others. This is illegal under Nigeria's Cybercrimes (Prohibition, Prevention, Etc.) Act 2015. Intellectual Property: Always give credit to original code authors. Do not copy other people's code and claim it as your own. Inclusive Design: Design programmes that are accessible to all users, including those with disabilities. Good programmers think about everyone. |
Classroom and Home Activities
Activity 1: Design a Class on Paper
Without using a computer, draw a 'class diagram' for a Nigerian market trader. Write down at least 4 attributes (e.g., trader_name, stall_number, goods_sold, daily_income) and 3 methods (e.g., sell_item(), restock(), calculate_profit()). Discuss your design with a classmate.
Activity 2: Find Objects Around You
Look around your home or school. Identify 5 real-world objects. For each object, write down: (a) what class it belongs to, (b) 3 attributes it has, and (c) 2 things it can do (methods). For example: Object = NEPA prepaid meter | Class = ElectricMeter | Attributes: meter_number, units_remaining, customer_name | Methods: recharge(), display_units().
Activity 3: Spot Inheritance in Real Life
Think about Nigerian road vehicles. Create an inheritance diagram starting with a parent class called 'Vehicle'. Then create at least three child classes (e.g., Danfo, Okada, Keke Napep, Lorry). List what each child class inherits from Vehicle and what unique attributes or methods each one adds.
Activity 4: Write a Simple Class in Python or Pseudocode
Write a class called 'Student' with the following: Attributes — name, school, class_level, score. Methods — greet() which prints a welcome message, get_grade() which returns an 'A', 'B', 'C', 'D', or 'F' based on the score. Create two student objects from this class and call their methods.
Assessment Questions
Section A: Objective Questions
Which of the following BEST describes a class in OOP?
A) A single running programme
B) A template or blueprint used to create objects
C) A type of database table
D) A method that stores data
Correct Answer: B
Encapsulation in OOP refers to:
A) Allowing all users to access all data freely
B) Hiding irrelevant background operations from the user
C) Bundling data and methods together and restricting direct access to some details
D) Creating multiple child classes from one parent class
Correct Answer: C
Which OOP principle allows a child class to use properties and methods of a parent class?
A) Abstraction
B) Polymorphism
C) Encapsulation
D) Inheritance
Correct Answer: D
In Python, the special method that runs automatically when a new object is created is called:
A) __start__
B) __init__
C) __create__
D) __new__
Correct Answer: B
Polymorphism means:
A) A class that has no objects
B) Different objects responding differently to the same method call
C) Combining two classes into one
D) Protecting attributes from external access
Correct Answer: B
Section B: Theory Questions
Explain the difference between a class and an object. Use a relevant Nigerian example to support your answer.
Describe the four pillars of Object-Oriented Programming. For each pillar, provide a brief real-life example that relates to Nigerian society or technology.
A Nigerian developer is building a hospital management system for a General Hospital in Abuja. (a) Suggest THREE classes the developer might create for this system. (b) For ONE of those classes, list four appropriate attributes and two appropriate methods. (c) Explain one way inheritance could be used in this hospital system.
Summary
Key Points to Remember ✔ Object-Oriented Programming (OOP) organises code around objects that combine data and behaviour. ✔ A class is a blueprint; an object is a specific instance created from that blueprint. ✔ The four pillars of OOP are: Encapsulation, Abstraction, Inheritance, and Polymorphism. ✔ OOP promotes reusability, scalability, and cleaner code structure. ✔ Real-world Nigerian applications — from Paystack to JAMB portals — use OOP principles. ✔ Ethical programming means protecting user data, respecting intellectual property, and building inclusive software. ✔ A constructor method (__init__ in Python) initialises object attributes when an object is first created. |
Conclusion
There has never been a better time to be a young Nigerian interested in technology. The country is producing world-class developers, and the demand for skilled programmers — locally and internationally — continues to grow every year.
Object-Oriented Programming is not just another topic to memorise for your examinations. It is a genuine way of thinking that will serve you whether you go on to study Computer Science at a Nigerian university, attend a coding bootcamp, or build the next great Nigerian tech startup from your bedroom in Kano, Port Harcourt, or Enugu.
Start small. Draw your classes on paper. Write simple objects in Python or Java. Experiment with inheritance. Ask your teacher questions. Visit platforms like Codecademy, W3Schools, or the official Python documentation online. Every expert was once a beginner, and every complex application started as a simple class with a few attributes and methods.
The foundation you are building today by understanding OOP is the same foundation that Paystack's engineers used when they built payment infrastructure that handles millions of Naira every single day. That future can belong to you too.
Frequently Asked Questions (FAQ)
Q1: Is OOP only for experienced programmers?
Not at all. OOP is taught at the Senior Secondary School level in Nigeria because it is designed to be learnable at that stage. Starting with simple classes and objects is enough. You do not need to master all four pillars at once. Take it step by step.
Q2: Which programming language should a Nigerian student use to learn OOP?
Python is widely recommended as the best starting language for OOP because its syntax is clean and easy to read. Java is also commonly used and is popular in Nigerian universities. Both are excellent choices and both are free to download and use.
Q3: What is the difference between OOP and procedural programming?
Procedural programming organises code as a sequence of instructions — one step after another. OOP organises code around objects that bundle data and behaviour together. OOP is generally better for large, complex systems, while procedural programming can be simpler for small scripts and tasks.
Q4: Can OOP be used for websites?
Yes, absolutely. Most modern web applications — including Nigerian fintech platforms, e-commerce sites, and government portals — are built using OOP principles. Languages like PHP, Python (Django/Flask), Java (Spring), and JavaScript (Node.js) all support OOP-based web development.
Q5: What does NERDC say about OOP in the Computer Science curriculum?
The Nigerian Educational Research and Development Council (NERDC) includes Advanced Programming — covering Object-Oriented Programming basics — in the Senior Secondary School Computer Studies/Science curriculum. It is designed to equip students with the practical programming skills needed for higher education and the modern workforce.
Q6: What careers in Nigeria require knowledge of OOP?
OOP knowledge is required or highly valued in careers such as Software Development, Mobile App Development (Android/iOS), Web Development, Database Administration, Systems Analysis, Game Development, and even Data Science. Companies like Interswitch, Flutterwave, Andela, and the Central Bank of Nigeria's IT division actively seek candidates with these skills.

0 Comments