Object Oriented Programming
The main difference between structured and object
oriented programming is:
● The structured programming allows developing a
program using a set of modules or functions
● while the object oriented programming allows
constructing a program using a set of objects and
their interactions.
Difference between Object-Oriented and
Structured Programming
Class
• A class is a template or prototype that describes what an
object will be. It defines its attributes(data) and
behavior(methods). We must design a class before
creating an object.
Object
• An object is an instance of a class. When we create an
object, we create real-world entities such as cars,
bicycles, or dogs with their own attributes and own
behaviors. The different objects of the class Vehicle can
be Car, Bike, Bicycle, etc. Each of them will have its
values for the fields like color, model_number, etc.
Abstraction
• Abstraction is the process of simplifying complex reality by
modeling classes based on the essential properties and
behaviors while ignoring non-essential details.
• It allows you to focus on what an object does rather than
how it does it. You can see the essential buttons on your TV
remote control, but you don’t care what happens when you
press one of these buttons. In Java, we create abstractions
via Interfaces and Abstract classes.
Polymorphism
• The word polymorphism means to have many forms. So, by
using polymorphism, you can add different meanings to a
single component.
There are two types of polymorphism:
• Run-time polymorphism & Compile-time polymorphism
Inheritance
• Inheritance is one of the most important features of object
oriented programming. It allows a class to inherit the
properties and methods of another class called the parent
class, the base class, or the super-class.
• The class that inherits is called the child class or sub-class.
• It allows the reusability of the code.
Encapsulation
• Encapsulation means enclosing the data/variables and the
methods for manipulating the data into a single entity called
a class. It helps to hide the internal implementation of the
functions and state of the variables, promoting abstraction.
What are the benefits of OOP?
• Modularity: OOP divides complex systems into smaller components,
making the codebase easier to understand, create, and maintain.
• Reusability: Inheritance allows code reuse, improving code quality
and saving time.
• Encapsulation: Protects data integrity and privacy by restricting
direct access and allowing controlled access through methods.
• Flexibility and Scalability: OOP enables easy addition and
modification of features without impacting the entire codebase.
• Code Maintenance: Changes and bug fixes can be made to specific
objects or classes without affecting other parts of the system,
reducing errors and improving debugging.
• Better Problem Solving: OOP models real-world systems, allowing
developers to create intuitive solutions that closely mimic real-world
circumstances.
Merits of Object Oriented Programming Languages
1. Improved software-development productivity
2. Improved software maintainability
3. Faster development
4. Lower cost of development
5. Higher-quality software
Demerits of Object Oriented Programming Languages
1. Slower programs: Compile time and run time overhead
and as they typically require more instructions to be
executed.
2. Unfamiliraity causes training overheads.
3. Not suitable for all types of problems
4. Larger program size: Object-oriented programs
typically involve more lines of code than procedural
programs
Demerits of Object Oriented Programming Languages
• Performance overhead: OOP languages often have a
performance cost compared to procedural languages due to the
additional abstraction layers introduced by objects and
encapsulation.
• Dependency management: Inheritance and code reuse in OOP
can create interdependencies among classes, making it difficult to
manage changes and maintain overall functionality.
• Overuse of inheritance: Improper use of inheritance can lead to
complex class hierarchies and tightly coupled classes, making
code maintenance and modifications more difficult in the future.
Applications of Object-Oriented Programming
• Real-business systems are often much more complex
and contain many more objects with complicated
attributes and methods. OOP is useful in this type of
applications because it can simplify a complex problem.
The different areas for application of OOP include:
1. Real-time systems
2. Simulation and modeling
3. Object-oriented databases
4. Hypertext, hypermedia
5. AI and Expert systems
6. Neural networks and parallel programming
7. Decision support and office automation systems
8. CIM/CAD/CAM systems

OOPsConceptspythonenineeringcomputerscienceand engineering.pptx

  • 1.
  • 2.
    The main differencebetween structured and object oriented programming is: ● The structured programming allows developing a program using a set of modules or functions ● while the object oriented programming allows constructing a program using a set of objects and their interactions.
  • 5.
    Difference between Object-Orientedand Structured Programming
  • 6.
    Class • A classis a template or prototype that describes what an object will be. It defines its attributes(data) and behavior(methods). We must design a class before creating an object. Object • An object is an instance of a class. When we create an object, we create real-world entities such as cars, bicycles, or dogs with their own attributes and own behaviors. The different objects of the class Vehicle can be Car, Bike, Bicycle, etc. Each of them will have its values for the fields like color, model_number, etc.
  • 8.
    Abstraction • Abstraction isthe process of simplifying complex reality by modeling classes based on the essential properties and behaviors while ignoring non-essential details. • It allows you to focus on what an object does rather than how it does it. You can see the essential buttons on your TV remote control, but you don’t care what happens when you press one of these buttons. In Java, we create abstractions via Interfaces and Abstract classes. Polymorphism • The word polymorphism means to have many forms. So, by using polymorphism, you can add different meanings to a single component. There are two types of polymorphism: • Run-time polymorphism & Compile-time polymorphism
  • 9.
    Inheritance • Inheritance isone of the most important features of object oriented programming. It allows a class to inherit the properties and methods of another class called the parent class, the base class, or the super-class. • The class that inherits is called the child class or sub-class. • It allows the reusability of the code. Encapsulation • Encapsulation means enclosing the data/variables and the methods for manipulating the data into a single entity called a class. It helps to hide the internal implementation of the functions and state of the variables, promoting abstraction.
  • 18.
    What are thebenefits of OOP? • Modularity: OOP divides complex systems into smaller components, making the codebase easier to understand, create, and maintain. • Reusability: Inheritance allows code reuse, improving code quality and saving time. • Encapsulation: Protects data integrity and privacy by restricting direct access and allowing controlled access through methods. • Flexibility and Scalability: OOP enables easy addition and modification of features without impacting the entire codebase. • Code Maintenance: Changes and bug fixes can be made to specific objects or classes without affecting other parts of the system, reducing errors and improving debugging. • Better Problem Solving: OOP models real-world systems, allowing developers to create intuitive solutions that closely mimic real-world circumstances.
  • 19.
    Merits of ObjectOriented Programming Languages 1. Improved software-development productivity 2. Improved software maintainability 3. Faster development 4. Lower cost of development 5. Higher-quality software
  • 20.
    Demerits of ObjectOriented Programming Languages 1. Slower programs: Compile time and run time overhead and as they typically require more instructions to be executed. 2. Unfamiliraity causes training overheads. 3. Not suitable for all types of problems 4. Larger program size: Object-oriented programs typically involve more lines of code than procedural programs
  • 21.
    Demerits of ObjectOriented Programming Languages • Performance overhead: OOP languages often have a performance cost compared to procedural languages due to the additional abstraction layers introduced by objects and encapsulation. • Dependency management: Inheritance and code reuse in OOP can create interdependencies among classes, making it difficult to manage changes and maintain overall functionality. • Overuse of inheritance: Improper use of inheritance can lead to complex class hierarchies and tightly coupled classes, making code maintenance and modifications more difficult in the future.
  • 22.
    Applications of Object-OrientedProgramming • Real-business systems are often much more complex and contain many more objects with complicated attributes and methods. OOP is useful in this type of applications because it can simplify a complex problem. The different areas for application of OOP include: 1. Real-time systems 2. Simulation and modeling 3. Object-oriented databases 4. Hypertext, hypermedia 5. AI and Expert systems 6. Neural networks and parallel programming 7. Decision support and office automation systems 8. CIM/CAD/CAM systems