SlideShare a Scribd company logo
Object Oriented
Programming
Object Oriented
Programming
About ME
CM / Chih-Ming / 志明
Ph.D Student in TIGP-SNHCC
Research Assistant at AS CITI
Algorithm Developer Intern at …
Advisor: Prof. Victor Tsai (蔡銘峰)
Advisor: Dr. Eric Yang (楊弈軒)
• CLIP Lab
• MAC Lab
https://about.me/chewme
What’s Object?
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
DOG CAR MAIL
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
DOG CAR MAIL
name
age
license_number
color
from_address
to_address
message
Class vs. Object
DOG CAR MAIL
bark() forward()
back()
send()
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
• An Object is the instance of a Class.

It obtains the variables and methods described in the Class.
Class vs. Object
• A Class is a blueprint of an Object.

It basically contains:

- Variables / Properties

- Methods / Functions
• An Object is the instance of a Class.

It obtains the variables and methods described in the Class.
CAR
Everything in Python is an Object
• 1234 is an instance of type integer
• "hello" is an instance of type string
• Lists, dictionaries are more complicated object types
• Functions are also objects

- parameter can be passed as another function
What’s OOP?
OOP
• OOP is a programming paradigm based on the concept of objects.
• There are four major benefits in OOP:



- Encapsulation: Package the variables and functions into a single unit.



- Abstraction: Show only the essentials to the outside use.



- Inheritance: Inherit common variables and functions.



- Polymorphism: Function the object depending on the data.
4 Principles of OOP
Encapsulation
Abstraction
Inheritance
Polymorphism
Encapsulation
Abstraction
Inheritance
Polymorphism
Encapsulation
Abstraction
Inheritance
Polymorphism
CAR
Encapsulation
Abstraction
Inheritance
Polymorphism
f() x
Class PropertyMethod
reduce complexity
increase reusability
Encapsulation
Abstraction
Inheritance
Polymorphism
Encapsulation
Abstraction
Inheritance
Polymorphism
Controller as an Object
buttons for you
buttons for you
Encapsulation
Abstraction
Inheritance
Polymorphism
Which design you like more?
Encapsulation
Abstraction
Inheritance
Polymorphism
f()
x x x
f() f()
x
Encapsulation
Abstraction
Inheritance
Polymorphism
f()
x x x
f() f()
x
hide some variables / functions
Encapsulation
Abstraction
Inheritance
Polymorphism
f()
x x x
f() f()
x
callable / public
non-callable / private
Encapsulation
Abstraction
Inheritance
Polymorphism
f()
x x x
f() f()
x
simplify interface
Encapsulation
Abstraction
Inheritance
Polymorphism
f()
x x x
f() f()
x
simplify interface
reduce impact of change
modify those hidden x & f() without changing the interface
Encapsulation
Abstraction
Inheritance
Polymorphism
Encapsulation
Abstraction
Inheritance
Polymorphism
VEHICLE
BIKE VAN TRUCK
carry()take()
new variables / functions in advanced class
store common variables / functions here
Encapsulation
Abstraction
Inheritance
Polymorphism
hierarchy
VEHICLE
WHEELED
VEHICLE
ELECTRIC
CAR
Encapsulation
Abstraction
Inheritance
Polymorphism
x1 / f1()
x1 / x2 / f1() x1 / f1() / f2()
Base Class
inherit x1 and f1()

from the base
Advanced Class Advanced Class
eliminate redundant codes
Encapsulation
Abstraction
Inheritance
Polymorphism
push button (A)
roll roll hit
bowling ball dice baseball
depending on context
Encapsulation
Abstraction
Inheritance
Polymorphism
Overloading
Overriding
Given the same Class
Parent / Child Class
Encapsulation
Abstraction
Inheritance
Polymorphism
Overloading
Method

Overloading
Operator

Overloading
__add__(self, other) à
__sub__(self, other) à
__eq__(self, other) à
__lt__(self, other) à
__len__(self) à
__str__(self) à
self + other
self – other
self == other
self < other
len(self)
print self
special operators

with underscore
https://docs.python.org/3/reference/datamodel.html#basic-customization
same function

with different processes
Encapsulation
Abstraction
Inheritance
Polymorphism
Overriding
WHEELED
VEHICLE
ELECTRIC
CAR
def forward():

# Process_A
def forward():

# Process_B
same interface with different processes inside
Why OOP?
• https://www.quora.com/What-are-the-advantages-of-OOP
Example Code?
• https://www.programiz.com/python-programming/object-oriented-programming
Any Question?
• changecandy@gmail.com
Ad

Recommended

Object Oriented programming - Introduction
Object Oriented programming - Introduction
Madishetty Prathibha
 
Oops ppt
Oops ppt
abhayjuneja
 
Introduction to oop
Introduction to oop
colleges
 
Introduction to OOP in Python
Introduction to OOP in Python
Aleksander Fabijan
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
Ajay Chimmani
 
Object oriented programming
Object oriented programming
Sandeep Kumar Singh
 
concept of oops
concept of oops
prince sharma
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
AyanaRukasar
 
Lecture 1 oop
Lecture 1 oop
Tony Apreku
 
Object-Oriented Programming Concepts
Object-Oriented Programming Concepts
Kwangshin Oh
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
Python unit 3 m.sc cs
Python unit 3 m.sc cs
KALAISELVI P
 
Object oriented programming
Object oriented programming
Amit Soni (CTFL)
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Polymorphism in oop
Polymorphism in oop
MustafaIbrahimy
 
Object Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
OOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
Ahmad karawash
 
object oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
Python-Inheritance.pptx
Python-Inheritance.pptx
Karudaiyar Ganapathy
 
Command line arguments
Command line arguments
Ashok Raj
 
Inheritance in Java
Inheritance in Java
Ferdin Joe John Joseph PhD
 
Function overloading and overriding
Function overloading and overriding
Rajab Ali
 
Oop Presentation
Oop Presentation
Ghaffar Khan
 
Object oriented programming concept
Object oriented programming concept
Pina Parmar
 
Object Oriented Programming Class and Objects
Object Oriented Programming Class and Objects
rubini8582
 
oop.pptx
oop.pptx
KabitaParajuli3
 

More Related Content

What's hot (20)

Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
AyanaRukasar
 
Lecture 1 oop
Lecture 1 oop
Tony Apreku
 
Object-Oriented Programming Concepts
Object-Oriented Programming Concepts
Kwangshin Oh
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
Python unit 3 m.sc cs
Python unit 3 m.sc cs
KALAISELVI P
 
Object oriented programming
Object oriented programming
Amit Soni (CTFL)
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Polymorphism in oop
Polymorphism in oop
MustafaIbrahimy
 
Object Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
OOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
Ahmad karawash
 
object oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
Python-Inheritance.pptx
Python-Inheritance.pptx
Karudaiyar Ganapathy
 
Command line arguments
Command line arguments
Ashok Raj
 
Inheritance in Java
Inheritance in Java
Ferdin Joe John Joseph PhD
 
Function overloading and overriding
Function overloading and overriding
Rajab Ali
 
Oop Presentation
Oop Presentation
Ghaffar Khan
 
Object oriented programming concept
Object oriented programming concept
Pina Parmar
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
AyanaRukasar
 
Object-Oriented Programming Concepts
Object-Oriented Programming Concepts
Kwangshin Oh
 
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
 
Python unit 3 m.sc cs
Python unit 3 m.sc cs
KALAISELVI P
 
Object oriented programming
Object oriented programming
Amit Soni (CTFL)
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Object Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
Ahmad karawash
 
object oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
Command line arguments
Command line arguments
Ashok Raj
 
Function overloading and overriding
Function overloading and overriding
Rajab Ali
 
Object oriented programming concept
Object oriented programming concept
Pina Parmar
 

Similar to Oop (20)

Object Oriented Programming Class and Objects
Object Oriented Programming Class and Objects
rubini8582
 
oop.pptx
oop.pptx
KabitaParajuli3
 
Chapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
Object oriented programming (oops) python
Object oriented programming (oops) python
TayyabaIrshad6
 
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
vidhimangal05
 
Object Oriented Programming using c++ main four piller in this
Object Oriented Programming using c++ main four piller in this
vidhimangal05
 
Classes are blueprints for creating objects
Classes are blueprints for creating objects
SSSs599507
 
Procedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
ShailendraPandey96
 
OOPS
OOPS
AnushkaGupta763558
 
Principles of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
Object Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdf
AshutoshKumar211882
 
Object_Oriented_Programming_combined.ppt
Object_Oriented_Programming_combined.ppt
ssuser8d54ed
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
l226207
 
object oriented programming and methodology.pptx
object oriented programming and methodology.pptx
ayush626953
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
Maharshi Dayanand University Rohtak
 
Computer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
Object Oriented Programming Class and Objects
Object Oriented Programming Class and Objects
rubini8582
 
Chapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
Object oriented programming (oops) python
Object oriented programming (oops) python
TayyabaIrshad6
 
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
vidhimangal05
 
Object Oriented Programming using c++ main four piller in this
Object Oriented Programming using c++ main four piller in this
vidhimangal05
 
Classes are blueprints for creating objects
Classes are blueprints for creating objects
SSSs599507
 
Procedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
ShailendraPandey96
 
Object Oriented Programming_combined.ppt.pdf
Object Oriented Programming_combined.ppt.pdf
AshutoshKumar211882
 
Object_Oriented_Programming_combined.ppt
Object_Oriented_Programming_combined.ppt
ssuser8d54ed
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
l226207
 
object oriented programming and methodology.pptx
object oriented programming and methodology.pptx
ayush626953
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Computer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
Ad

More from 志明 陳 (10)

RecSys'19 SMORe
RecSys'19 SMORe
志明 陳
 
ML Toolkit Share
ML Toolkit Share
志明 陳
 
CM NCCU Class2
CM NCCU Class2
志明 陳
 
CM NCCU Class1
CM NCCU Class1
志明 陳
 
CM UTaipei Kaggle Share
CM UTaipei Kaggle Share
志明 陳
 
MLDM CM Kaggle Tips
MLDM CM Kaggle Tips
志明 陳
 
CM KaggleTW Share
CM KaggleTW Share
志明 陳
 
KAMERA 2nd solution
KAMERA 2nd solution
志明 陳
 
PIXNET Page Views 1st solution
PIXNET Page Views 1st solution
志明 陳
 
KDD CUP 2015 - 9th solution
KDD CUP 2015 - 9th solution
志明 陳
 
RecSys'19 SMORe
RecSys'19 SMORe
志明 陳
 
ML Toolkit Share
ML Toolkit Share
志明 陳
 
CM NCCU Class2
CM NCCU Class2
志明 陳
 
CM NCCU Class1
CM NCCU Class1
志明 陳
 
CM UTaipei Kaggle Share
CM UTaipei Kaggle Share
志明 陳
 
MLDM CM Kaggle Tips
MLDM CM Kaggle Tips
志明 陳
 
CM KaggleTW Share
CM KaggleTW Share
志明 陳
 
KAMERA 2nd solution
KAMERA 2nd solution
志明 陳
 
PIXNET Page Views 1st solution
PIXNET Page Views 1st solution
志明 陳
 
KDD CUP 2015 - 9th solution
KDD CUP 2015 - 9th solution
志明 陳
 
Ad

Recently uploaded (20)

Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...
ijait
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
KhadijaKhadijaAouadi
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
20CE601- DESIGN OF STEEL STRUCTURES ,INTRODUCTION AND ALLOWABLE STRESS DESIGN
20CE601- DESIGN OF STEEL STRUCTURES ,INTRODUCTION AND ALLOWABLE STRESS DESIGN
gowthamvicky1
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...
ijait
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
KhadijaKhadijaAouadi
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
20CE601- DESIGN OF STEEL STRUCTURES ,INTRODUCTION AND ALLOWABLE STRESS DESIGN
20CE601- DESIGN OF STEEL STRUCTURES ,INTRODUCTION AND ALLOWABLE STRESS DESIGN
gowthamvicky1
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 

Oop