OOP Lecture 1
OOP Lecture 1
OOP Lecture 1
Oriented
Programming
Example:
Consider an e-commerce platform where you need to handle different types of
products, payments, and shipping methods. OOP allows you to create modular
classes like Product, PaymentMethod, and ShippingMethod. When you need to
introduce new types of products or payment methods, you can extend existing
classes without modifying the entire system.
Comparison between OOP and Procedural Programming
3. Collaboration and Teamwork:
Procedural:
1. Strengths: Can be more straightforward for individual development or small
teams.
2. Weaknesses: This may lead to challenges in collaboration as the project scales,
especially when multiple developers are working on different functions.
OOP:
1. Strengths: Encourages a more natural representation of real-world entities,
making it easier for teams to collaborate. Code can be divided into classes, and
developers can work on different components simultaneously.
2. Weaknesses: Requires a good understanding of class relationships and
hierarchies, which may be challenging for some developers.
Comparison between OOP and Procedural Programming
3. Collaboration and Teamwork:
Example:
Imagine developing a video game where you have different characters, weapons,
and environments. OOP is advantageous here because each element can be
represented as a class (e.g., Character, Weapon, Environment). Different team
members can work on different aspects of the game without interfering with
each other's code.
Summary
Organizational Paradigm:
1. OOP: Objects and classes structure the code.
2. Procedural: Procedures and functions dictate code organization.
Code Reusability:
1. OOP: High reusability through features like inheritance and polymorphism.
2. Procedural: Limited code reusability; functions are task-specific.
Data Handling:
1. OOP: Emphasis on encapsulation for data security.
2. Procedural: Relies on global data, potentially impacting modularity.
Flexibility and Extensibility:
1. OOP: Flexibility via polymorphism; extensibility with inheritance.
2. Procedural: Flexibility through functions; extensibility may be more challenging.
Design Philosophy:
1. OOP: Holistic design based on essential properties and behaviors.
2. Procedural: Sequential design philosophy, organizing code into steps or tasks.
Question session??