Why Object Oriented Programming?
Object-Oriented Programming (OOP) is used to create better, more intuitive representations of real-life objects in our code. Humans naturally think and understand the world in terms of objects, like cars, books, or people. OOP leverages this way of thinking by allowing programmers to model software based on these real-world concepts.
Basic OOP concepts:
- Class: A blueprint for creating objects (example: cars)
- Object: An instance of the class (example: a specific car created based on the blueprint)
- Attributes: The characteristics of these objects (example: car's color, year of production, and model)
- Methods: The actions or behaviors of the object (example: driving fast or honking the horn)
Exercises
What does OOP stand for?
 Only Operator Programming | ||
 Object-Oriented Programming | ||
 Object Option Protocol | ||
 Order of Operations Programming |
Which of the following are basic concepts of Object-Oriented Programming (OOP)?
 Class | ||
 Object | ||
 Attribute | ||
 Method |
An instance of the class (example: a specific car created based on the blueprint) is called:
 Class | ||
 Object | ||
 Attribute | ||
 Method |
The actions or behaviors of the object (example: driving fast or honking the horn) are called:
 Classes | ||
 Objects | ||
 Attributes | ||
 Methods |
Which of the following are examples of real-life actions that could be methods?
 Color | ||
 Year of production | ||
 Honking | ||
 Driving |
Exercises
Object-Oriented Programming (OOP) is used to create better, more intuitive representations of real-life objects in our code.
 Correct | ||
 Incorrect |
A blueprint for creating objects (example: cars) is called:
 Object | ||
 Class | ||
 Attribute | ||
 Method |
The characteristics of these objects (example: car's color, year of production, and model) are called:
 Objects | ||
 Classes | ||
 Attributes | ||
 Methods |
Which of the following are attributes of a car object?
 Color | ||
 Year of production | ||
 Honking | ||
 Accelerating |
Which benefits are provided by Object-Oriented Programming?
 Code is more organized | ||
 Code models real-life concepts | ||
 Code always runs faster | ||
 Only one developer can work on OOP code |