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

PDF
Reviewing OOP Design patterns
PDF
Object oriented approach in python programming
PPTX
Python OOPs
PPTX
Python - OOP Programming
PPTX
Clean code
PDF
C# Summer course - Lecture 2
PPTX
Advanced Python : Static and Class Methods
PPT
Unit 1 Java
Reviewing OOP Design patterns
Object oriented approach in python programming
Python OOPs
Python - OOP Programming
Clean code
C# Summer course - Lecture 2
Advanced Python : Static and Class Methods
Unit 1 Java

What's hot (20)

PPTX
Python oop third class
PPTX
Comparable/ Comparator
PPTX
Structure of java program diff c- cpp and java
PPTX
Intro to OOP PHP and Github
PPTX
Advance OOP concepts in Python
PPTX
Basics of Object Oriented Programming in Python
PPTX
Python Session - 3
PPTX
The Awesome Python Class Part-5
PPTX
Introduction to PHP OOP
DOC
My c++
PPTX
11 Unit 1 Chapter 02 Python Fundamentals
PDF
C# Summer course - Lecture 1
PPTX
Variables in python
PPTX
PPTX
Classes and objects
PPSX
Comparable and comparator – a detailed discussion
PPTX
Polymorphism in java
PDF
M.c.a (sem iii) paper - i - object oriented programming
PDF
Python oop third class
Comparable/ Comparator
Structure of java program diff c- cpp and java
Intro to OOP PHP and Github
Advance OOP concepts in Python
Basics of Object Oriented Programming in Python
Python Session - 3
The Awesome Python Class Part-5
Introduction to PHP OOP
My c++
11 Unit 1 Chapter 02 Python Fundamentals
C# Summer course - Lecture 1
Variables in python
Classes and objects
Comparable and comparator – a detailed discussion
Polymorphism in java
M.c.a (sem iii) paper - i - object oriented programming
Ad

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

PPTX
Python advance
PDF
Unit 3-Classes ,Objects and Inheritance.pdf
PDF
Python - object oriented
PPTX
Presentation_4516_Content_Document_20250204010703PM.pptx
PPTX
Python-Classes.pptx
PPTX
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
PPTX
Object Oriented Programming Class and Objects
PPTX
Object Oriented Programming.pptx
PPTX
IPP-M5-C1-Classes _ Objects python -S2.pptx
PDF
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
PPTX
Object oriented Programming in Python.pptx
PPTX
object oriented porgramming using Java programming
PDF
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
PPT
Python session 7 by Shan
PPTX
Introduction to OOP_Python_Lecture1.pptx
PDF
Lecture 01 - Basic Concept About OOP With Python
PPTX
Object-Oriented Programming in Python.pptx
PPTX
Python programming computer science and engineering
PPTX
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
Python advance
Unit 3-Classes ,Objects and Inheritance.pdf
Python - object oriented
Presentation_4516_Content_Document_20250204010703PM.pptx
Python-Classes.pptx
Class_and_Object_with_Example_Python.pptx janbsbznnsbxghzbbshvxnxhnwn
Object Oriented Programming Class and Objects
Object Oriented Programming.pptx
IPP-M5-C1-Classes _ Objects python -S2.pptx
جلسه هفتم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
Object oriented Programming in Python.pptx
object oriented porgramming using Java programming
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
Python session 7 by Shan
Introduction to OOP_Python_Lecture1.pptx
Lecture 01 - Basic Concept About OOP With Python
Object-Oriented Programming in Python.pptx
Python programming computer science and engineering
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
Ad

More from oudesign (20)

PPTX
Week 8 multicultural images OUacademicTech
PPT
ITS-35505-Amazing_photoshop_slideshow
PPTX
CST 20363 Session 7 - Blockchain
PPTX
CST 20363 Session 6 Cybersecurity Policy
PPTX
CST 20363 Session 6 Cyberspace
PPTX
CST 20363 Session 5 Robotics
PPTX
CST 20363 Session 3
PPTX
CST 20363 Session 4 Computer Logic Design
PPTX
CST 20363 Session 2
PPTX
CST 20363-Session 1.2-A Brief History of Computing
PPTX
CST-20363-Session 1.1-Something Called CS
PPTX
CST-20363-Session 1-In the Bitginning
PPTX
Synthetic Division
PPTX
Week 7 Database Development Process
PPTX
Week 6 Normalization
PPT
Week 4 The Relational Data Model & The Entity Relationship Data Model
PPT
Week 3 Classification of Database Management Systems & Data Modeling
PPT
Week 2 Characteristics & Benefits of a Database & Types of Data Models
PPTX
Week 1 Lab Directions
PPT
Week 1 Before the Advent of Database Systems & Fundamental Concepts
Week 8 multicultural images OUacademicTech
ITS-35505-Amazing_photoshop_slideshow
CST 20363 Session 7 - Blockchain
CST 20363 Session 6 Cybersecurity Policy
CST 20363 Session 6 Cyberspace
CST 20363 Session 5 Robotics
CST 20363 Session 3
CST 20363 Session 4 Computer Logic Design
CST 20363 Session 2
CST 20363-Session 1.2-A Brief History of Computing
CST-20363-Session 1.1-Something Called CS
CST-20363-Session 1-In the Bitginning
Synthetic Division
Week 7 Database Development Process
Week 6 Normalization
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 3 Classification of Database Management Systems & Data Modeling
Week 2 Characteristics & Benefits of a Database & Types of Data Models
Week 1 Lab Directions
Week 1 Before the Advent of Database Systems & Fundamental Concepts

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PDF
Business Ethics Teaching Materials for college
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PPTX
Cell Structure & Organelles in detailed.
PPTX
Onica Farming 24rsclub profitable farm business
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PDF
English Language Teaching from Post-.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Revamp in MTO Odoo 18 Inventory - Odoo Slides
Business Ethics Teaching Materials for college
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Cardiovascular Pharmacology for pharmacy students.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Module 3: Health Systems Tutorial Slides S2 2025
Cell Structure & Organelles in detailed.
Onica Farming 24rsclub profitable farm business
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
UPPER GASTRO INTESTINAL DISORDER.docx
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
English Language Teaching from Post-.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
NOI Hackathon - Summer Edition - GreenThumber.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
102 student loan defaulters named and shamed – Is someone you know on the list?

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