SlideShare a Scribd company logo
WEBINAR ON PYTHON
- Jyoti Shukla (SME)
AGENDA
 Object-Oriented Programming in Python
 Numpy
 Pandas
BACKGROUND
 Procedure Oriented Programming
 OOPS concept
 Features of OOP
 Class
 Object
 Encapsulation
 Inheritance
 Polymorphism
 Abstraction
PROCEDURE ORIENTED PROGRAMMING
 Procedural programming uses a list of instructions
to perform computations step by step.
 It works on sequential instructions divided into small
parts called functions or procedures.
 It is not easy to maintain the codes when the project
becomes lengthy.
 Testing consumes a lot of time for enterprise
projects.
 Procedural languages do not provide a proper way
for data hiding, so it becomes less secure.
OBJECT-ORIENTED PROGRAMMING (OOP)
 Object-oriented programming (OOP) is a
programming paradigm based on the concept of
"objects", which can contain data member and
code.
 Data member is in the form of fields (often known as
attributes or properties), and Code, is in the form of
methods (relate it to behaviors or functions).
FEATURES OF OOPS
OOP
Object
Class
Encapsula
tion
Data
Abstractio
n
Inheritanc
e
Polymorp
hism
WHAT IS CLASS..?
 A class can be defined as a template/ blueprint that
describes the state and behavior of an object of its
type.
 A class contain fields and methods to describe the
state and behaviour of an object respectively.
Methods are the members of a class that alter the
state of an object by performing business logics.
REPRESENTATION OF A CLASS
CLASS DEFINITION
WHAT IS OBJECT?
 Objects are the basic run-time real entities in an object-
oriented system.
 They may represent a person, a place, a bank account,
a table of data or any item that the program must
handle.
 An object has two characteristics: Attributes & Behavior.
 Classes are just a logical representation whereas
Objects are physical representation.
 Objects upon initialization are loaded in memory.
 Syntax: reference variable=classname()
 For Example: s1 = Student()
VARIABLES IN CLASSES
Data/Fields/Attributes/Properties can be represented
by a variable. A variable by its definition means
something that can be changed.
Types of variable.
• instance (scope: object)
• static (scope: class)
• local(scope: method)
INSTANCE VARIABLES
 An instance variable of an object is a piece of
information attached to an instance (object).
 Instance variables are defined inside the instance
method and constructor by using "self" keyword.
 Example: studentId, firstname, lastname etc.
 An object can usually have many instance
variables, of many different types.
 Each object is given its own private space(Memory)
to hold its instance variable.
 Assigning a new value to an instance variable of
one object does not affect the instance variables of
any other object.
METHOD IN CLASSES
Types of Methods:
 instance Method
 class method
 static method
INSTANCE METHODS
 When we define objects, we usually have an idea of
what we want to do with them.
 I'm dealing with Person objects in an employee
database... I should be able to ask each Person
object their name, weight, and age.
 An action that involves a single object is usually
implemented as a special kind of
function/subroutine attached to that object's class,
called an instance method (or, more commonly, just
a method).
__INIT__() METHOD
 The __init__() method is the constructor and is
always called when an object is created.
 Constructor is a special type of method which is
used to initialize the instance variables of the class.
 Syntax of constructor declaration.
def __init__(self):
#body of constructor
 This method can take any number of
arguments. However, the first argument "self" in the
definition is special.
SELF
 The first argument of instance method and
constructor is a reference to the current instance of
the class.
 Similar to the keyword "this" in Java, C++ etc.
 You do not give a value for this parameter(self)
when you call the method, Python will provide it
automatically.
ENCAPSULATION
 Encapsulation is used to restrict access to methods
and variables. In encapsulation, code and data are
wrapped together within a single unit from being
modified by accident.
 It can be achieved by: private members of class
 __variable
 __method
 Access to this data is typically only achieved
through special methods: Getters and Setters By
using solely get() and set() methods
PRIVATE DATA
 Variable names starting with two underscore
characters cannot be accessed from outside of the
class. At least not directly, but they can be
accessed through public members of class.
class Encapsulation(object):
def __init__(self, a, b, c):
self.public = a
self.__private=b
EXAMPLE
INHERITANCE
 Inheritance is the capability of one class to derive or
inherit the properties from some another class.
 Benefits of inheritance are:
 It represents real-world relationships well.
 It provides reusability of a code. We don’t have to write
the same code again and again. Also, it allows us to add
more features to a class without modifying it.
 It is transitive in nature, which means that if class B
inherits from another class A, then all the subclasses of
B would automatically inherit from class A.
Syntax:
class derivedclass(base class):
TYPES OF INHERITANCE
1. Single inheritance
2. Multiple inheritance
3. Multilevel Inheritance
4. Hybrid Inheritance
5. Hierarchical Inheritance
SINGLE INHERITANCE
When a child class inherits from only one
parent class, it is called as single
inheritance.
MULTIPLE INHERITANCE
 When a child class inherits from multiple parent
classes.
 Python supports multiple inheritance. We specify
all parent classes as comma separated list in
bracket.
MULTILEVEL INHERITANCE
Multi-level inheritance is achieved when a derived
class inherits another derived class.
HYBRID INHERITANCE
 This form combines more than one form of
inheritance. Basically, it is a blend of more than one
type of inheritance
POLYMORPHISM
 Polymorphism is ability to use a common interface
for multiple forms (data types).
 It refers to the use of a single type entity (method,
operator or object) to represent different types in
different scenarios.
POLYMORPHISM CONTD.
We can implement polymorphism by
 Overloading
operator
method
constructor
 Overriding
method
constructor
POLYMORPHISM CONTD.
 Method Overloading, a way to create multiple
methods with the same name but different
arguments.
 It is achieved by passing different number
of arguments or by passing different types of
arguments.
POLYMORPHISM CONTD.
 Method Overriding: It allows us to change the
implementation of function in the child class which
is defined in the parent class.
 Following conditions must be met for overriding
a function:
Inheritance should be implemented. Method overriding
cannot be done within a class. We need to derive a child
class from a parent class.
The function that is redefined in the child class should
have the same definition/ signature as in the parent
class i.e. same number of parameters.
DATA ABSTRACTION
 It is the process of hiding the real implementation of an
application from the user and emphasizing only on
usage of it.
 E.g. when you use mobile, we need not know how
pressing a key changes the volume level. We just need
to know that pressing up button increases the volume
and the down button reduces the volume.
Why Do We Need Abstraction?
Through the process of abstraction, a programmer can
hide all the irrelevant data/process of an application in
order to reduce complexity, provide security and
increase the efficiency.
DATA ABSTRACTION CONTD.
Abstract class
 Abstract class are the classes which contain one or
more abstract method.
Abstract Method
 Abstract Methods are the methods which only
have declaration and no definition.
IMPLEMENTATION
Thank You

More Related Content

What's hot

CLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONCLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHON
Lalitkumar_98
 
Python OOPs
Python OOPsPython OOPs
Python OOPs
Binay Kumar Ray
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
Neelesh Shukla
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
Pranali Chaudhari
 
Python programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphismPython programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphism
Emertxe Information Technologies Pvt Ltd
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
Youssef Mohammed Abohaty
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
foreverredpb
 
Python oop third class
Python oop   third classPython oop   third class
Python oop third class
Aleksander Fabijan
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classes
asadsardar
 
C++ classes
C++ classesC++ classes
C++ classes
imhammadali
 
Class, object and inheritance in python
Class, object and inheritance in pythonClass, object and inheritance in python
Class, object and inheritance in python
Santosh Verma
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
Python Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | EdurekaPython Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | Edureka
Edureka!
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
Alok Kumar
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
rfojdar
 
Python oop - class 2 (inheritance)
Python   oop - class 2 (inheritance)Python   oop - class 2 (inheritance)
Python oop - class 2 (inheritance)
Aleksander Fabijan
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
Devashish Kumar
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 

What's hot (20)

CLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONCLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHON
 
Python OOPs
Python OOPsPython OOPs
Python OOPs
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Python programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphismPython programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphism
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
 
Python oop third class
Python oop   third classPython oop   third class
Python oop third class
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classes
 
C++ classes
C++ classesC++ classes
C++ classes
 
Class, object and inheritance in python
Class, object and inheritance in pythonClass, object and inheritance in python
Class, object and inheritance in python
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Python Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | EdurekaPython Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | Edureka
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
 
Python oop - class 2 (inheritance)
Python   oop - class 2 (inheritance)Python   oop - class 2 (inheritance)
Python oop - class 2 (inheritance)
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 

Similar to object oriented programming(PYTHON)

Python advance
Python advancePython advance
Python advance
Mukul Kirti Verma
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
tuyambazejeanclaude
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Iqra khalil
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
Vibrant Technologies & Computers
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
Usman Mehmood
 
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeObject Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
DrDhivyaaCRAssistant
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
DrDhivyaaCRAssistant
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)
smumbahelp
 
Only oop
Only oopOnly oop
Only oop
anitarooge
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
Richa Gupta
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
Prof. Dr. K. Adisesha
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
Prof. Dr. K. Adisesha
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
Connex
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
Aly Abdelkareem
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
apoorvams
 

Similar to object oriented programming(PYTHON) (20)

Python advance
Python advancePython advance
Python advance
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeObject Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)
 
Only oop
Only oopOnly oop
Only oop
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 

Recently uploaded

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 

Recently uploaded (20)

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 

object oriented programming(PYTHON)

  • 1. WEBINAR ON PYTHON - Jyoti Shukla (SME)
  • 2. AGENDA  Object-Oriented Programming in Python  Numpy  Pandas
  • 3. BACKGROUND  Procedure Oriented Programming  OOPS concept  Features of OOP  Class  Object  Encapsulation  Inheritance  Polymorphism  Abstraction
  • 4. PROCEDURE ORIENTED PROGRAMMING  Procedural programming uses a list of instructions to perform computations step by step.  It works on sequential instructions divided into small parts called functions or procedures.  It is not easy to maintain the codes when the project becomes lengthy.  Testing consumes a lot of time for enterprise projects.  Procedural languages do not provide a proper way for data hiding, so it becomes less secure.
  • 5. OBJECT-ORIENTED PROGRAMMING (OOP)  Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data member and code.  Data member is in the form of fields (often known as attributes or properties), and Code, is in the form of methods (relate it to behaviors or functions).
  • 7. WHAT IS CLASS..?  A class can be defined as a template/ blueprint that describes the state and behavior of an object of its type.  A class contain fields and methods to describe the state and behaviour of an object respectively. Methods are the members of a class that alter the state of an object by performing business logics.
  • 10. WHAT IS OBJECT?  Objects are the basic run-time real entities in an object- oriented system.  They may represent a person, a place, a bank account, a table of data or any item that the program must handle.  An object has two characteristics: Attributes & Behavior.  Classes are just a logical representation whereas Objects are physical representation.  Objects upon initialization are loaded in memory.  Syntax: reference variable=classname()  For Example: s1 = Student()
  • 11. VARIABLES IN CLASSES Data/Fields/Attributes/Properties can be represented by a variable. A variable by its definition means something that can be changed. Types of variable. • instance (scope: object) • static (scope: class) • local(scope: method)
  • 12. INSTANCE VARIABLES  An instance variable of an object is a piece of information attached to an instance (object).  Instance variables are defined inside the instance method and constructor by using "self" keyword.  Example: studentId, firstname, lastname etc.  An object can usually have many instance variables, of many different types.  Each object is given its own private space(Memory) to hold its instance variable.  Assigning a new value to an instance variable of one object does not affect the instance variables of any other object.
  • 13. METHOD IN CLASSES Types of Methods:  instance Method  class method  static method
  • 14. INSTANCE METHODS  When we define objects, we usually have an idea of what we want to do with them.  I'm dealing with Person objects in an employee database... I should be able to ask each Person object their name, weight, and age.  An action that involves a single object is usually implemented as a special kind of function/subroutine attached to that object's class, called an instance method (or, more commonly, just a method).
  • 15. __INIT__() METHOD  The __init__() method is the constructor and is always called when an object is created.  Constructor is a special type of method which is used to initialize the instance variables of the class.  Syntax of constructor declaration. def __init__(self): #body of constructor  This method can take any number of arguments. However, the first argument "self" in the definition is special.
  • 16. SELF  The first argument of instance method and constructor is a reference to the current instance of the class.  Similar to the keyword "this" in Java, C++ etc.  You do not give a value for this parameter(self) when you call the method, Python will provide it automatically.
  • 17. ENCAPSULATION  Encapsulation is used to restrict access to methods and variables. In encapsulation, code and data are wrapped together within a single unit from being modified by accident.  It can be achieved by: private members of class  __variable  __method  Access to this data is typically only achieved through special methods: Getters and Setters By using solely get() and set() methods
  • 18. PRIVATE DATA  Variable names starting with two underscore characters cannot be accessed from outside of the class. At least not directly, but they can be accessed through public members of class. class Encapsulation(object): def __init__(self, a, b, c): self.public = a self.__private=b
  • 20. INHERITANCE  Inheritance is the capability of one class to derive or inherit the properties from some another class.  Benefits of inheritance are:  It represents real-world relationships well.  It provides reusability of a code. We don’t have to write the same code again and again. Also, it allows us to add more features to a class without modifying it.  It is transitive in nature, which means that if class B inherits from another class A, then all the subclasses of B would automatically inherit from class A. Syntax: class derivedclass(base class):
  • 21. TYPES OF INHERITANCE 1. Single inheritance 2. Multiple inheritance 3. Multilevel Inheritance 4. Hybrid Inheritance 5. Hierarchical Inheritance
  • 22. SINGLE INHERITANCE When a child class inherits from only one parent class, it is called as single inheritance.
  • 23. MULTIPLE INHERITANCE  When a child class inherits from multiple parent classes.  Python supports multiple inheritance. We specify all parent classes as comma separated list in bracket.
  • 24. MULTILEVEL INHERITANCE Multi-level inheritance is achieved when a derived class inherits another derived class.
  • 25. HYBRID INHERITANCE  This form combines more than one form of inheritance. Basically, it is a blend of more than one type of inheritance
  • 26. POLYMORPHISM  Polymorphism is ability to use a common interface for multiple forms (data types).  It refers to the use of a single type entity (method, operator or object) to represent different types in different scenarios.
  • 27. POLYMORPHISM CONTD. We can implement polymorphism by  Overloading operator method constructor  Overriding method constructor
  • 28. POLYMORPHISM CONTD.  Method Overloading, a way to create multiple methods with the same name but different arguments.  It is achieved by passing different number of arguments or by passing different types of arguments.
  • 29. POLYMORPHISM CONTD.  Method Overriding: It allows us to change the implementation of function in the child class which is defined in the parent class.  Following conditions must be met for overriding a function: Inheritance should be implemented. Method overriding cannot be done within a class. We need to derive a child class from a parent class. The function that is redefined in the child class should have the same definition/ signature as in the parent class i.e. same number of parameters.
  • 30. DATA ABSTRACTION  It is the process of hiding the real implementation of an application from the user and emphasizing only on usage of it.  E.g. when you use mobile, we need not know how pressing a key changes the volume level. We just need to know that pressing up button increases the volume and the down button reduces the volume. Why Do We Need Abstraction? Through the process of abstraction, a programmer can hide all the irrelevant data/process of an application in order to reduce complexity, provide security and increase the efficiency.
  • 31. DATA ABSTRACTION CONTD. Abstract class  Abstract class are the classes which contain one or more abstract method. Abstract Method  Abstract Methods are the methods which only have declaration and no definition.

Editor's Notes

  1. For eg: Let's assume, we need to replicate a Zoo in a program. We will list out all the animals and create functions for them or we can make a single function and handle all animals in that function. Now, animals have distinct behaviors along with some common behaviors and all of them have some pattern. All animals eat, sleep, walk, make noise and run but their patterns are different. Also, animals have distinct properties like Elephants have trunk, Rhinos have horns etc. To address this, we need to pass each and every property as a parameter to the function so that function knows what to do for which animal combination. Even if we created separate functions for each animal to reduce the complexity, it would still be difficult to complete the process without any glitches(unexpected fault). So, there is need for an approach which is more realistic.
  2. As we came across the drawbacks of procedure oriented programming, let's learn how oop fixed them and gave us a much simpler and at the same time a robust way to programming which is still in use.