OOPsConceptspythonenineeringcomputerscienceand engineering.pptx

PraharikaCh 24 views 22 slides Sep 28, 2024
Slide 1
Slide 1 of 22
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22

About This Presentation

it is a presenation explaining oops concept in proper way


Slide Content

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 Improved software-development productivity Improved software maintainability Faster development Lower cost of development Higher-quality software

Demerits of Object Oriented Programming Languages Slower programs: Compile time and run time overhead and as they typically require more instructions to be executed. Unfamiliraity causes training overheads. Not suitable for all types of problems 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: Real-time systems Simulation and modeling Object-oriented databases Hypertext, hypermedia AI and Expert systems Neural networks and parallel programming Decision support and office automation systems CIM/CAD/CAM systems