Object-Oriented Programming
Object-oriented programming organises code into objects that combine data and the methods that act on that data.
▶ Interact
Play with the controls to see the idea in action.
📘 Learn
Object-oriented programming organises code into objects that combine data and the methods that act on that data.
- A class is a blueprint
- An object is an instance
- Inheritance reuses code
🧠 Quick quiz
Three questions. Score 2 or more to complete the topic.
What is Object-Oriented Programming?
Within Computer Science, which covers algorithms, programming, data, networks, hardware and safe, responsible use of technology, this topic explains Object-Oriented Programming. Computing topics explain how software, hardware and data work, with diagrams and models that show each step in order.
Check that you can explain Object-Oriented Programming in your own words and give one example from everyday life. If you can do that, you have understood the core idea.
Understanding Object-Oriented Programming helps you design, test and explain programs, websites and systems, from small projects to exam questions.
Object-Oriented Programming in detail
Object-oriented programming (OOP) organises programs around objects, which combine data (attributes) and actions (methods). A class is a blueprint that defines these, and an object is a particular instance of the class. For example, a Car class has attributes like colour and speed and methods like accelerate().
Key principles are encapsulation (hiding internal details and controlling access), inheritance (a new class reuses and extends an existing one, such as ElectricCar from Car), polymorphism (different classes responding to the same method in their own way) and abstraction. OOP helps manage large programs by making code reusable and modular.
How the interactive helps you understand Object-Oriented Programming
Click a card to flip it and reveal the answer, then move on to the next one.
Before you change anything, predict the result. Then change one value at a time and check whether your prediction was right. This is a quick way to build a correct mental model of Object-Oriented Programming.
Real-life uses and examples
- Trace through a process that uses Object-Oriented Programming to check what it does step by step.
- Recognise Object-Oriented Programming in an app or device you use every day.
- Apply Object-Oriented Programming when you design a small program, website or spreadsheet.
Common mistakes to avoid
- Testing only the normal case and forgetting the edge cases.
- Using the term without being able to say what the computer actually does.
- Learning the definition without testing it. Use the quiz and the interactive to check that you can apply the idea.
Frequently asked questions about Object-Oriented Programming
What is Object-Oriented Programming?
Object-oriented programming organises code into objects that combine data and the methods that act on that data.
What are the most important points about Object-Oriented Programming?
The main points are: A class is a blueprint; An object is an instance; Inheritance reuses code.
Why is Object-Oriented Programming useful?
Understanding Object-Oriented Programming helps you design, test and explain programs, websites and systems, from small projects to exam questions.
How can I practise Object-Oriented Programming?
Open the interactive at the top of this page and change the controls one at a time. Predict the result before each change, then take the three-question quiz. A score of two or more marks the topic as complete on this device.
Which topics are related to Object-Oriented Programming?
Related topics in Computer Science include Introduction to Python, Introduction to JavaScript, Networks: LAN and WAN.