Benefits of Object Oriented
Programming
GROUP 4
TANAKA L MUZIRI R232993J
TADIWA B CHIPUNGUMBERI R233087R
LAVET B MBEWE R232996P
JOSEPH KATSANDE R237063W
AUSTINE MUKOMI R236852N
OOP
A programming paradigm that uses objects to represent data and methods to
manipulate data
Object Oriented programming (OOP), is a way of programming that focuses on
using objects and classes to design and build applications
Major pillars of OOP are Inheritance, Polymorphism, Abstraction, and
Encapsulation.
Popular Benefits:
Modularity
Reusability
Abstraction
Polymorphism
Modularity
Organizes code into manageable units
Reduces complexity and improves maintainability
Allow for easier modification and extension
Reusability
Through inheritance and polymorphism OOP enables code
reuse
Reduces redundancy and improves development efficiency
Allows for easier adaptation to changing requirements
In this example, Car inherit the start() method from
the Vehivle class, which means we don’t have to rewrite it in
each new class. Additionally, it adds its unique methods—
honk() for Car(Vehivle) . This approach keeps code
organized, reduces redundancy, and makes it easy to add
new features based on existing classes.
Abstraction
Hides complex system details
Provides a simplified interface for easier use
For example : The "Car" Class is Like a Real Car
It has clear actions: start_engine(), accelerate(),
brake().
Private variable:__engine_on can’t be changed
directly.
Only control the car via the brake() and
start_engine() methods
Maintainability
Improves code structure and or
organization
Reduces complexity and improves
understandability
Allows for easier modification and
extension
In this example, the Person class is
organized in a way that allows it to grow.
You can add more methods,
like contact_info, without needing to
change other parts of the code. This makes
future updates easier and keeps the code
organized.
Polymorphism
Enables objects to take multiple forms
Improves flexibility and adaptability
Allows for more efficient and effective coding
Example
for i in shapes:
print(i.area())
Will give a result of each shapes area
Here, the single area() method adjusts based on the
Shape type. Polymorphism saves time and allows easy
addition of new shape types without changing the main
code.
Enhanced security
Through encapsulation there is data binding
essential for security
Improves access control and security
Allows for a more secureand reliable coding
In this example, the balance attribute is private,
meaning it can’t be accessed directly. Instead,
the deposit() and withdrawal() methods provide
controlled access to it, protecting the data while
allowing modifications only through approved
methods. Encapsulation helps safeguard
sensitive data and keeps the codebase secure
and easy to manage.
Real world data modelling
Being able to represent real world objects or systems
Improves the ability to understand real world systems
Conclusion
OOP – programming paradigm focused on object creation and use
Benefits include abstraction(data hiding), code reuse(inheritance) and
objects taking multiple forms(polymorphism)