0% found this document useful (0 votes)
28 views31 pages

Fundamentals of OOP

Uploaded by

aishwarya.pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views31 pages

Fundamentals of OOP

Uploaded by

aishwarya.pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

1

Prof. Aishwarya Pawar


POINTS TO BE COVERED

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.

 The Code Is Written In A Programming Language


That The Computer Can Understand

 You Can Think Of Programming As A Collaboration


Between Humans And Computers, In Which Humans
Create Instructions For A Computer To Follow
(Code) In A Language Computers Can Understand.
4
PROGRAMMING LANG AVAILABLE

 There are many programming languages


because each one is designed for different
tasks, preferences, or ways of thinking.
 Some are good for fast performance, others
for ease of use or specific jobs like data
analysis or web development.
 It's like having different tools for different
jobs—each language helps you do different
things better.
HOW COMPUTER UNDERSTAND 5
PROGRAM
 Computers don't understand programming
languages directly.
 A computer’s program only consists of two
different characters – the 0 and the 1 – therefore
it is also called a binary program.
 A compiler is a program that translates the
source code written in a higher programming
language into the machine-readable binary
language code. The result is “executable code”,
also known as object code or target language.
 Writing Code: You write code in a
programming language, like Python or Java.

 Compilation or Interpretation: The code needs


to be translated into machine language (binary)
that the computer can understand. This is done in
two main ways:
• Compilation: A program called a compiler
translates your entire code into machine language
all at once. For example, C++ uses a compiler.
• Interpretation: An interpreter translates and
executes your code line by line. Python uses an
interpreter.

 Execution: Once the code is translated into


binary, the computer’s processor can execute it,
performing the tasks you’ve programmed.
2.TYPES OF PROGRAMMING LANGUAGE
LOW LEVEL LANGUAGE
 Low-level programming languages are machine-dependent programming
languages that mainly depend on binary values( 0’s and 1’s).
 the processor itself can run low-level programming languages without the
intervention of any kind of compilers or interpreters. As a result, low-level
programming languages can run very fast.

1.Machine level languages:


2.Assembly languages:
LOW LEVEL LANGUAGE
1.Machine level languages:
 Machine languages are also known as machine code or object code. Machine languages can be very
easily readable and understandable as it is normally displayed in binary form.

 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.

Some of the machine languages are….


ARM
DEC
x86
IBM System/360
MIPS
2.Assembly languages:

 The ASMs, popularly known as assembly languages,


represent a set of symbols that can be easily
understood by humans.

 To convert the assembly language to machine


language, it simply uses a converter in order to take
the required conversion.

Some of the assembly languages are….


•ASEM-51
•ASCENT
•AKI
•ASPER
HIGH LEVEL LANGUAGE
 High-level programming languages enable people to write user-friendly
programs which are closer and more understandable to humans and
farther to machine language.

 High-level programming language is used for designing user-friendly


programs and websites.

 This kind of programming language requires a compiler or interpreter to


translate the program into machine language.

 High-level programming languages are easy to read, write, and easy to


maintain.
 High-level programming languages are further classified into three parts.
They are…
1.Procedural-oriented programming language
2.Object-oriented programming language
3.Natural language
1.Procedural-oriented programming languages:
 Procedural-oriented programming languages are based upon procedural call concepts.
 This kind of programming language divides the entire program into small portions
called routines or functions.
 This kind of programming language makes it easy for the user to easily track the flow
of control of the program and code re-usability can be done throughout the program.
 Some of the procedural-oriented programming languages are….

•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.

Some of the object-oriented programming languages are….


 Scala
 C++
 Java
 Python
OOP Is Based On The Idea Of Classes And Objects.

 It Organizes A Computer Program Into Basic, Reusable Blueprints Of Code Or “Classes.”


 These Classes Are Then Used And Reused To Create New And Unique Objects With Similar
Functions.
 This Paradigm Represents A System That Interacts With Actual Items In Real Life – Such As The
User.
 Simula is considered the first object-oriented programming language..
 Smalltalk is considered the first truly object-oriented programming language.
 The popular object-oriented languages are
Java, C#, PHP, Python, C++, etc.
ADVANTAGES OF OOP:

 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.

 In OOP, code is typically structured using classes and objects.

1. Object
2. Class
3. Principles of OOP-
Encapsulation
Abstraction
Inheritance
Polymorphism
4.Messgae Communication
21
1.OBJECT 22

 Any Entity That Has State And Behavior Is Known As


An Object
 It Can Be Physical Or Logical.
 An Object Can Be Defined As An Instance Of A Class.
An Object Contains An Address And Takes Up Some
Space In Memory.
 An Object Has An Identity, State, And Behavior.
 Each Object Contains Data And Code To Manipulate

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

common to all objects of one type. A class is like a


blueprint for an object.
 Class doesn't consume any space.
STRUCTURE OF CLASS 24

 Class Definition- Begin with class keyword


 Attributes/Properties
 Behaviour
Basic example of class in Python

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}")

# Create an instance(object) of Car


my_car = Car("Toyota", "Corolla")

# Call a method on the instance


my_car.display_info()
3.ENCAPSULATION 25

 Encapsulation is defined as the wrapping up of data


under a single unit.
 It is the mechanism that binds together code and the
data it manipulates.
 In Encapsulation, the variables or data of a class are
hidden from any other class and can be accessed only
through any member function of their class in which
they are declared.
 As in encapsulation, the data in a class is hidden from
other classes, so it is also known as data-hiding.
4.ABSTRACTION 26

 Hiding internal details and showing functionality is known as


abstraction.
 Abstraction in OOPS is used to hide unnecessary information and
display only necessary information to the users interacting.
 It is essential to represent real-world objects in a simplified manner for
users to interact easily.
27

5.POLYMORPHISM
 The word polymorphism means having many forms. In

simple words, we can define polymorphism as the ability

of a message to be displayed in more than one form.


 For example, A person at the same time can have

different characteristics.
 Like a man at the same time is a father, a husband, an

employee. So the same person posses different behavior

in different situations. This is called polymorphism.


28

TYPES OF POLYMORPHISM
6.INHERITANCE 29

 It is an important pillar of OOP(Object-Oriented


Programming). The capability of a class to derive
properties and characteristics from another class is called
Inheritance.
 When we write a class, we inherit properties from other
classes. So when we create a class, we do not need to write
all the properties and functions again and again, as these
can be inherited from another class that possesses it.
 Inheritance allows the user to reuse the code whenever
possible and reduce its redundancy.
TYPES OF INHERITANCE 30
THANK YOU

You might also like