Fundamentals of OOP
Fundamentals of OOP
1. Introduction to Programming
2. Types of Programming Language-
OOP
3. Key Concepts of OOP
1.WHAT IS PROGRAMMING??
Computer Programming, Also Known As Coding,
Is The Process Of Writing Instructions, Or Code,
That Tells A Computer How To Perform Tasks.
Computers can directly understand machine language programs so there is no requirement for a
translator to convert the programs. Machine languages can be executed very fast when compared
with high-level languages as the processor itself takes care of the execution.
•FORTRAN
•ALGOL
•COBOL
•BASIC
•PASCAL
•C
WORKING OF POP
Procedure Oriented Programming (or POP) is a way of programming in
which there are different functions made for performing different tasks.
This is the basic approch of the procedural programming approach.
It is often called procedure-oriented programming.
Advantages of POP:
Simple to Understand:
Organized Code
Reusable Code:
Disadvantages of POP:
Hard to Manage as Programs Grow:
Less Focus on Data:
Object-oriented programming languages:
Object-oriented programming languages are a kind of
language, which mainly depends on objects.
In this type of programming language, the entire program
is divided into parts, which are known as objects.
These objects are used to implement some of the
programming methods like polymorphism, inheritance,
abstraction, etc.
The main advantage of object-oriented programming
languages is that these kinds of languages are faster and
easier to execute, and easy to maintain.
FLEXIBILITY
REUSABILITY:
ORGANIZED CODE:
DISADVANTAGES OF OOP:
COMPLEXITY:
OVERHEAD:
18
Aspect OOP POP
Core Concept Focus on objects and classes. Focus on functions and procedures.
Code Organized around classes and objects. Organized around functions and procedures.
Organization
Data Emphasizes encapsulation, data is accessed through Data may be global and accessible to all functions.
Accessibility methods.
Code Promotes code reusability through inheritance and Functions can be reused, but code is less modular.
Reusability polymorphism.
Inheritance Supports inheritance for code sharing and Does not have inherent support for inheritance.
extending functionality.
Polymorphism Allows polymorphic behavior, where methods can Not a primary feature, as it's not cantered around
behave differently based on the object's type. objects.
Modularity Encourages modularity through classes and objects, Modularity can be achieved through functions, but
promoting easy maintenance and updates. not as naturally as in OOP.
Real-World Well-suited for modelling real-world entities and Less intuitive for modelling real-world objects and
Modelling relationships. their interactions.
20
KEY CONCEPT OF OOP
Object-Oriented Programming is a way of organizing your code—also referred to as a
programming paradigm.
1. Object
2. Class
3. Principles of OOP-
Encapsulation
Abstraction
Inheritance
Polymorphism
4.Messgae Communication
21
1.OBJECT 22
The Data.
ATTRIBUTE= MEMBERS
BEHAVIOR= METHOD
23
2.CLASS
Collection of objects is called class. It is a logical
entity.
A class is a user-defined data type
It consists of data members and member functions,
It represents the set of properties or methods that are
class Car:
def __init__(self, make, model):
self.make = make
self.model = model
def display_info(self):
print(f"Car make: {self.make}, model:
{self.model}")
5.POLYMORPHISM
The word polymorphism means having many forms. In
different characteristics.
Like a man at the same time is a father, a husband, an
TYPES OF POLYMORPHISM
6.INHERITANCE 29