SlideShare a Scribd company logo
ITS 16163 INTRODUCTION TO
COMPUTER PROGRAMMING
Object-Oriented Programming
(OOP)
3
 Python has been an object-oriented language
since it existed.
 Because of this, you can create classes and
object.
 Object-Oriented Programming it’s a modern
methodology that’s been embraced by the
software industry.
 It’s used in the creation of the majority of new,
commercial software.
 The basic building block in OOP is the software
object often just called an object.
Object-Oriented Programming (OOP)
4
 What you often want to represent in your
programs anything from a checking account to an
alien spacecraft are real-life objects.
 OOP lets you represent these real-life objects as
software
 Like real-life objects, software objects combine:
 characteristics called attributes
 behaviors called methods
For example: if you were to create an alien
spacecraft object, its attributes could include its
location and energy level, while its methods could
include its ability to move or fire its weapons.
UNDERSTANDING OBJECT-ORIENTED
BASICS
5
 Objects are created (or instantiated) from a
definition called a class
 Class is a programming code that can define
attributes and methods. Like blueprints.
 A class isn’t an object, it’s a design for one.
For Example: An engineer can create many
houses from the same blueprint, a programmer can
create many objects from the same class.
 As a result, each object (also called an instance)
instantiated from the same class will have a
similar structure. So, if you have a checking
account class, you could use it to create multiple
checking account objects. But each object has
UNDERSTANDING OBJECT-ORIENTED
BASICS
6
 The class statement creates a new class
definition. The name of the class immediately
follows the keyword class followed by a colon.
Example:
class Employee:
 You’ll notice that my class name begins with a
capital letter. Python doesn’t require this, but it’s
the standard convention, so you should begin all
your class names with a capital letter.
 The next line is a docstring, which documents the
class. A good docstring describes the kind of
objects a class can be used to create.
'Common base class for all employees‘
OOP Creating Classes
7
 The first method __init__() is a special method,
which is called class constructor or initialization
method that Python calls when you create a new
instance of this class.
def __init__(self, name, salary):
 You can think of methods as functions associated with
an object.
def displayEmployee(self):
 The displayEmployee() method prints the string:
"Name : ", and "Salary: “
 You’ll notice that displayEmployee () has one
parameter, self (which it doesn’t happen to use).
Every instance method a method that every object of
a class has must have a special first parameter, called
OOP Creating Method
8
 To create instances of a class, you call the class using
class name and pass in whatever arguments
its __init__ method accepts.
Example: Class Employee:
"This would create first object of Employee class"
emp1 = Employee("Zara", 2000)
 This line creates a brand-new object of the Employee
class and assigns it to the variable emp1.
 Once you’ve written a class, creating multiple objects
is very easy.
Example:
Emp2 = Employee("Manni", 5000) Creating
multiple objects
OOP Creating Instance Objects
9
Example Code: critter_caretaker
Example Code: OOP
 Use the example code:
 Execute the examples under Chapter 7 OOP
Example (trinket.io)
Controlling Attribute Access

More Related Content

What's hot

Python oop third class
Python oop   third classPython oop   third class
Python oop third class
Aleksander Fabijan
 
Comparable/ Comparator
Comparable/ ComparatorComparable/ Comparator
Comparable/ Comparator
Sean McElrath
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Intro to OOP PHP and Github
Intro to OOP PHP and GithubIntro to OOP PHP and Github
Intro to OOP PHP and Github
Jo Erik San Jose
 
Advance OOP concepts in Python
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in Python
Sujith Kumar
 
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
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
AnirudhaGaikwad4
 
The Awesome Python Class Part-5
The Awesome Python Class Part-5The Awesome Python Class Part-5
The Awesome Python Class Part-5
Binay Kumar Ray
 
Introduction to PHP OOP
Introduction to PHP OOPIntroduction to PHP OOP
Introduction to PHP OOP
fakhrul hasan
 
My c++
My c++My c++
My c++
snathick
 
11 Unit 1 Chapter 02 Python Fundamentals
11  Unit 1 Chapter 02 Python Fundamentals11  Unit 1 Chapter 02 Python Fundamentals
11 Unit 1 Chapter 02 Python Fundamentals
Praveen M Jigajinni
 
C# Summer course - Lecture 1
C# Summer course - Lecture 1C# Summer course - Lecture 1
C# Summer course - Lecture 1
mohamedsamyali
 
PHP Classes and OOPS Concept
PHP Classes and OOPS ConceptPHP Classes and OOPS Concept
Variables in python
Variables in pythonVariables in python
Variables in python
Jaya Kumari
 
Oops
OopsOops
Classes and objects
Classes and objectsClasses and objects
Classes and objects
Ashok Kumar
 
Comparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussionComparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussion
Dharmendra Prasad
 
Polymorphism in java
Polymorphism in java Polymorphism in java
Polymorphism in java
Janu Jahnavi
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
रवींद्र वैद्य
 
Lecture 4
Lecture 4Lecture 4

What's hot (20)

Python oop third class
Python oop   third classPython oop   third class
Python oop third class
 
Comparable/ Comparator
Comparable/ ComparatorComparable/ Comparator
Comparable/ Comparator
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
 
Intro to OOP PHP and Github
Intro to OOP PHP and GithubIntro to OOP PHP and Github
Intro to OOP PHP and Github
 
Advance OOP concepts in Python
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in Python
 
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
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
The Awesome Python Class Part-5
The Awesome Python Class Part-5The Awesome Python Class Part-5
The Awesome Python Class Part-5
 
Introduction to PHP OOP
Introduction to PHP OOPIntroduction to PHP OOP
Introduction to PHP OOP
 
My c++
My c++My c++
My c++
 
11 Unit 1 Chapter 02 Python Fundamentals
11  Unit 1 Chapter 02 Python Fundamentals11  Unit 1 Chapter 02 Python Fundamentals
11 Unit 1 Chapter 02 Python Fundamentals
 
C# Summer course - Lecture 1
C# Summer course - Lecture 1C# Summer course - Lecture 1
C# Summer course - Lecture 1
 
PHP Classes and OOPS Concept
PHP Classes and OOPS ConceptPHP Classes and OOPS Concept
PHP Classes and OOPS Concept
 
Variables in python
Variables in pythonVariables in python
Variables in python
 
Oops
OopsOops
Oops
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Comparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussionComparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussion
 
Polymorphism in java
Polymorphism in java Polymorphism in java
Polymorphism in java
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 

Similar to ITS-16163: Module 7 Introduction to Object-Oriented Programming Basics

Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
Karudaiyar Ganapathy
 
Lesson 13 object and class
Lesson 13 object and classLesson 13 object and class
Lesson 13 object and class
MLG College of Learning, Inc
 
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdfPython Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
SudhanshiBakre1
 
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdfPython Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
SudhanshiBakre1
 
Pythonclass
PythonclassPythonclass
Unit - 3.pptx
Unit - 3.pptxUnit - 3.pptx
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Module 4.pptx
Module 4.pptxModule 4.pptx
Module 4.pptx
charancherry185493
 
Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 
Creating class, self variables in Python
Creating class, self variables in PythonCreating class, self variables in Python
Creating class, self variables in Python
AditiPawaskar5
 
Oop java
Oop javaOop java
Oop java
Minal Maniar
 
Oop
OopOop
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Object Oriented PHP - PART-1
Object Oriented PHP - PART-1Object Oriented PHP - PART-1
Object Oriented PHP - PART-1
Jalpesh Vasa
 
PythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programmingPythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programming
KhadijaKhadijaAouadi
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov
 
Class 1 blog
Class 1 blogClass 1 blog
Class 1 blog
Narcisa Velez
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
Sudip Simkhada
 
Oops in PHP
Oops in PHPOops in PHP
Oops in PHP
Mindfire Solutions
 

Similar to ITS-16163: Module 7 Introduction to Object-Oriented Programming Basics (20)

Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
 
Lesson 13 object and class
Lesson 13 object and classLesson 13 object and class
Lesson 13 object and class
 
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdfPython Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
 
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdfPython Classes_ Empowering Developers, Enabling Breakthroughs.pdf
Python Classes_ Empowering Developers, Enabling Breakthroughs.pdf
 
Pythonclass
PythonclassPythonclass
Pythonclass
 
Unit - 3.pptx
Unit - 3.pptxUnit - 3.pptx
Unit - 3.pptx
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Module 4.pptx
Module 4.pptxModule 4.pptx
Module 4.pptx
 
Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
 
Creating class, self variables in Python
Creating class, self variables in PythonCreating class, self variables in Python
Creating class, self variables in Python
 
Oop java
Oop javaOop java
Oop java
 
Oop
OopOop
Oop
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
 
Object Oriented PHP - PART-1
Object Oriented PHP - PART-1Object Oriented PHP - PART-1
Object Oriented PHP - PART-1
 
PythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programmingPythonOO.pdf oo Object Oriented programming
PythonOO.pdf oo Object Oriented programming
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5
 
Class 1 blog
Class 1 blogClass 1 blog
Class 1 blog
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
Oops in PHP
Oops in PHPOops in PHP
Oops in PHP
 

More from oudesign

Week 8 multicultural images OUacademicTech
Week 8 multicultural images OUacademicTechWeek 8 multicultural images OUacademicTech
Week 8 multicultural images OUacademicTech
oudesign
 
ITS-35505-Amazing_photoshop_slideshow
ITS-35505-Amazing_photoshop_slideshowITS-35505-Amazing_photoshop_slideshow
ITS-35505-Amazing_photoshop_slideshow
oudesign
 
CST 20363 Session 7 - Blockchain
CST 20363 Session 7 - BlockchainCST 20363 Session 7 - Blockchain
CST 20363 Session 7 - Blockchain
oudesign
 
CST 20363 Session 6 Cybersecurity Policy
CST 20363 Session 6 Cybersecurity PolicyCST 20363 Session 6 Cybersecurity Policy
CST 20363 Session 6 Cybersecurity Policy
oudesign
 
CST 20363 Session 6 Cyberspace
CST 20363 Session 6 CyberspaceCST 20363 Session 6 Cyberspace
CST 20363 Session 6 Cyberspace
oudesign
 
CST 20363 Session 5 Robotics
CST 20363 Session 5 RoboticsCST 20363 Session 5 Robotics
CST 20363 Session 5 Robotics
oudesign
 
CST 20363 Session 3
CST 20363 Session 3CST 20363 Session 3
CST 20363 Session 3
oudesign
 
CST 20363 Session 4 Computer Logic Design
CST 20363 Session 4 Computer Logic DesignCST 20363 Session 4 Computer Logic Design
CST 20363 Session 4 Computer Logic Design
oudesign
 
CST 20363 Session 2
CST 20363 Session 2CST 20363 Session 2
CST 20363 Session 2
oudesign
 
CST 20363-Session 1.2-A Brief History of Computing
CST 20363-Session 1.2-A Brief History of ComputingCST 20363-Session 1.2-A Brief History of Computing
CST 20363-Session 1.2-A Brief History of Computing
oudesign
 
CST-20363-Session 1.1-Something Called CS
CST-20363-Session 1.1-Something Called CSCST-20363-Session 1.1-Something Called CS
CST-20363-Session 1.1-Something Called CS
oudesign
 
CST-20363-Session 1-In the Bitginning
CST-20363-Session 1-In the BitginningCST-20363-Session 1-In the Bitginning
CST-20363-Session 1-In the Bitginning
oudesign
 
Synthetic Division
Synthetic DivisionSynthetic Division
Synthetic Division
oudesign
 
Week 7 Database Development Process
Week 7 Database Development ProcessWeek 7 Database Development Process
Week 7 Database Development Process
oudesign
 
Week 6 Normalization
Week 6 NormalizationWeek 6 Normalization
Week 6 Normalization
oudesign
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign
 
Week 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data ModelingWeek 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data Modeling
oudesign
 
Week 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data ModelsWeek 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data Models
oudesign
 
Week 1 Lab Directions
Week 1 Lab DirectionsWeek 1 Lab Directions
Week 1 Lab Directions
oudesign
 
Week 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental ConceptsWeek 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental Concepts
oudesign
 

More from oudesign (20)

Week 8 multicultural images OUacademicTech
Week 8 multicultural images OUacademicTechWeek 8 multicultural images OUacademicTech
Week 8 multicultural images OUacademicTech
 
ITS-35505-Amazing_photoshop_slideshow
ITS-35505-Amazing_photoshop_slideshowITS-35505-Amazing_photoshop_slideshow
ITS-35505-Amazing_photoshop_slideshow
 
CST 20363 Session 7 - Blockchain
CST 20363 Session 7 - BlockchainCST 20363 Session 7 - Blockchain
CST 20363 Session 7 - Blockchain
 
CST 20363 Session 6 Cybersecurity Policy
CST 20363 Session 6 Cybersecurity PolicyCST 20363 Session 6 Cybersecurity Policy
CST 20363 Session 6 Cybersecurity Policy
 
CST 20363 Session 6 Cyberspace
CST 20363 Session 6 CyberspaceCST 20363 Session 6 Cyberspace
CST 20363 Session 6 Cyberspace
 
CST 20363 Session 5 Robotics
CST 20363 Session 5 RoboticsCST 20363 Session 5 Robotics
CST 20363 Session 5 Robotics
 
CST 20363 Session 3
CST 20363 Session 3CST 20363 Session 3
CST 20363 Session 3
 
CST 20363 Session 4 Computer Logic Design
CST 20363 Session 4 Computer Logic DesignCST 20363 Session 4 Computer Logic Design
CST 20363 Session 4 Computer Logic Design
 
CST 20363 Session 2
CST 20363 Session 2CST 20363 Session 2
CST 20363 Session 2
 
CST 20363-Session 1.2-A Brief History of Computing
CST 20363-Session 1.2-A Brief History of ComputingCST 20363-Session 1.2-A Brief History of Computing
CST 20363-Session 1.2-A Brief History of Computing
 
CST-20363-Session 1.1-Something Called CS
CST-20363-Session 1.1-Something Called CSCST-20363-Session 1.1-Something Called CS
CST-20363-Session 1.1-Something Called CS
 
CST-20363-Session 1-In the Bitginning
CST-20363-Session 1-In the BitginningCST-20363-Session 1-In the Bitginning
CST-20363-Session 1-In the Bitginning
 
Synthetic Division
Synthetic DivisionSynthetic Division
Synthetic Division
 
Week 7 Database Development Process
Week 7 Database Development ProcessWeek 7 Database Development Process
Week 7 Database Development Process
 
Week 6 Normalization
Week 6 NormalizationWeek 6 Normalization
Week 6 Normalization
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
 
Week 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data ModelingWeek 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data Modeling
 
Week 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data ModelsWeek 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data Models
 
Week 1 Lab Directions
Week 1 Lab DirectionsWeek 1 Lab Directions
Week 1 Lab Directions
 
Week 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental ConceptsWeek 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental Concepts
 

Recently uploaded

Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

ITS-16163: Module 7 Introduction to Object-Oriented Programming Basics

  • 1. ITS 16163 INTRODUCTION TO COMPUTER PROGRAMMING
  • 3. 3  Python has been an object-oriented language since it existed.  Because of this, you can create classes and object.  Object-Oriented Programming it’s a modern methodology that’s been embraced by the software industry.  It’s used in the creation of the majority of new, commercial software.  The basic building block in OOP is the software object often just called an object. Object-Oriented Programming (OOP)
  • 4. 4  What you often want to represent in your programs anything from a checking account to an alien spacecraft are real-life objects.  OOP lets you represent these real-life objects as software  Like real-life objects, software objects combine:  characteristics called attributes  behaviors called methods For example: if you were to create an alien spacecraft object, its attributes could include its location and energy level, while its methods could include its ability to move or fire its weapons. UNDERSTANDING OBJECT-ORIENTED BASICS
  • 5. 5  Objects are created (or instantiated) from a definition called a class  Class is a programming code that can define attributes and methods. Like blueprints.  A class isn’t an object, it’s a design for one. For Example: An engineer can create many houses from the same blueprint, a programmer can create many objects from the same class.  As a result, each object (also called an instance) instantiated from the same class will have a similar structure. So, if you have a checking account class, you could use it to create multiple checking account objects. But each object has UNDERSTANDING OBJECT-ORIENTED BASICS
  • 6. 6  The class statement creates a new class definition. The name of the class immediately follows the keyword class followed by a colon. Example: class Employee:  You’ll notice that my class name begins with a capital letter. Python doesn’t require this, but it’s the standard convention, so you should begin all your class names with a capital letter.  The next line is a docstring, which documents the class. A good docstring describes the kind of objects a class can be used to create. 'Common base class for all employees‘ OOP Creating Classes
  • 7. 7  The first method __init__() is a special method, which is called class constructor or initialization method that Python calls when you create a new instance of this class. def __init__(self, name, salary):  You can think of methods as functions associated with an object. def displayEmployee(self):  The displayEmployee() method prints the string: "Name : ", and "Salary: “  You’ll notice that displayEmployee () has one parameter, self (which it doesn’t happen to use). Every instance method a method that every object of a class has must have a special first parameter, called OOP Creating Method
  • 8. 8  To create instances of a class, you call the class using class name and pass in whatever arguments its __init__ method accepts. Example: Class Employee: "This would create first object of Employee class" emp1 = Employee("Zara", 2000)  This line creates a brand-new object of the Employee class and assigns it to the variable emp1.  Once you’ve written a class, creating multiple objects is very easy. Example: Emp2 = Employee("Manni", 5000) Creating multiple objects OOP Creating Instance Objects
  • 9. 9 Example Code: critter_caretaker Example Code: OOP  Use the example code:  Execute the examples under Chapter 7 OOP Example (trinket.io) Controlling Attribute Access