SlideShare a Scribd company logo
1
INTRODUCTION TO OOP
Objective:
•Know the difference between functional programming
and OOP
• Know basic terminology in OOP
• Know the importance of OOP
• Know four design principles of OOP
• Know OOP programming languages
2
STRUCTURED vs. OO PROGRAMMING
STRUCTURED PROGRAMMING:
MAIN PROGRAM
FUNCTION 3
FUNCTION 2
GLOBAL DATA
FUNCTION 5
FUNCTION 4
FUNCTION
1
3
Structured Programming
Using function
Function & program is divided into modules
Every module has its own data and function
which can be called by other modules.
4
OBJECT ORIENTED PROGRAMMING
Object 1
Object 2
Data
Function
Data
Function
Object 3
Data
Function
5
OBJECT ORIENTED PROGRAMMING
Objects have both data and methods
Objects of the same class have the same data
elements and methods
Objects send and receive messages to invoke actions
Key idea in object-oriented:
The real world can be accurately described as a collection of
objects that interact.
6
Basic terminology
object
- usually a person, place or thing (a noun)
method
- an action performed by an object (a verb)
attribute
- description of objects in a class
class
- a category of similar objects (such as automobiles)
- does not hold any values of the object’s attributes
7
Example for attributes and methods
Attributes:
manufacturer’s
name
model name
year made
color
number of doors
size of engine
etc.
Methods:
Define data items
(specify
manufacturer’s
name, model,
year, etc.)
Change a data
item (color,
engine, etc.)
Display data items
Calculate cost
etc.
8
Why OOP?
Save development time (and cost) by reusing
code
once an object class is created it can be used in
other applications
Easier debugging
classes can be tested independently
reused objects have already been tested
9
Design Principles of OOP
Four main design principles of Object-Oriented
Programming(OOP):
Encapsulation
Abstraction
Polymorphism
Inheritance
10
Encapsulation
Also known as data hiding
Only object’s methods can modify information in
the object.
Analogy:
ATM machine can only update accounts of one
person or object only.
11
Abstraction
Focus only on the important facts about the
problem at hand
to design, produce, and describe so that it
can be easily used without knowing the
details of how it works.
Analogy:
When you drive a car, you don’t have to
know how the gasoline and air are mixed and
ignited.
Instead you only have to know how to use
the controls.
Draw map
12
Polymorphism
the same word or phrase can mean different
things in different contexts
Analogy:
In English, bank can mean side of a river or a
place to put money
move -
13
Function Overloading
The operation of one function depends on
the argument passed to it.
Example: Fly(), Fly(low), Fly(150)
14
Inheritance
Inheritance—a way of organizing classes
Term comes from inheritance of traits like eye
color, hair color, and so on.
Classes with properties in common can be
grouped so that their common properties are only
defined once.
Superclass – inherit its attributes & methods to
the subclass(es).
Subclass – can inherit all its superclass attributes
& methods besides having its own unique
attributes & methods.
15
An Inheritance Hierarchy
Vehicle
Automobile Motorcycle Bus
Sedan Sports Car School Bus
Luxury Bus
What properties does each vehicle inherit from the types
of vehicles above it in the diagram?
Superclass
Subclasses
16
Object-Oriented Programming Languages
 Pure OO Languages
Smalltalk, Eiffel, Actor, Java
 Hybrid OO Languages
C++, Objective-C, Object-Pascal
17
Review: Introduction to Object
Orientation
What are the four basic principles of object
orientation? Provide a brief description of
each.
What is an Object and what is a Class? What
is the difference between them?
What is an Attribute?
What is an Operation?
What is inheritance?
What is polymorphism?
Describe the strengths of object orientation.
18
Review: Introduction to Object
Orientation
State 2 differences between functional
programming and OOP.
What are the four basic principles of object
orientation? Provide a brief description of
each.
What is an Object and what is a Class? What
is the difference between them?
What is an Attribute?
What is an Operation?
Describe the strengths of object orientation.

More Related Content

PPTX
Object oriented programming
PPTX
Concepts of oops
PPT
C plusplus
PDF
Oop concepts classes_objects
PPTX
Introduction to Object Oriented Programming
PDF
Cs8392 u1-1-oop intro
PPTX
inheritance in C++
Object oriented programming
Concepts of oops
C plusplus
Oop concepts classes_objects
Introduction to Object Oriented Programming
Cs8392 u1-1-oop intro
inheritance in C++

What's hot (20)

PPSX
C#, OOP introduction and examples
PPT
Object oriented vs. object based programming
PDF
OOP Inheritance
PPTX
SE-IT JAVA LAB OOP CONCEPT
PDF
Inheritance
PPTX
concept of oops
PPTX
Java OOP Concept
PDF
Total oop in c# dot net
PPTX
Object Oriented Concept
PPTX
Inheritance in c++
PPTX
Abstraction and Encapsulation
PDF
Object Oriented Programming using C++ Part II
PPTX
Principles and advantages of oop ppt
PPT
20. Object-Oriented Programming Fundamental Principles
PPT
2 Object Oriented Programming
PDF
Introduction to oops concepts
PPT
PPTX
Introduction to OOP concepts
PDF
C++ OOPS Concept
C#, OOP introduction and examples
Object oriented vs. object based programming
OOP Inheritance
SE-IT JAVA LAB OOP CONCEPT
Inheritance
concept of oops
Java OOP Concept
Total oop in c# dot net
Object Oriented Concept
Inheritance in c++
Abstraction and Encapsulation
Object Oriented Programming using C++ Part II
Principles and advantages of oop ppt
20. Object-Oriented Programming Fundamental Principles
2 Object Oriented Programming
Introduction to oops concepts
Introduction to OOP concepts
C++ OOPS Concept
Ad

Similar to Intro tooop (20)

PPT
OOP programming
PPT
IntroToOOP.ppt
PPT
IntroToOOP.ppt
PPT
IntroToOOP.ppt
PPT
IntroToOOP.ppt
PPT
IntroT.ppt
PPT
IntroductionToObjectOrientedProgrammingLanguage
PPT
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
PPT
Basics of object oriented programming interview tips for Java
PPTX
OOP-1.pptx
PPTX
Object oriented programming
PPTX
oop.pptx
PPTX
Intro to oop.pptx
PDF
Computer_Programming_Part_II_Segment_01.pdf
PPTX
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
PPTX
Introduction to oop with c++
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PPTX
Introduction to Object Oriented Programming.pptx
PPTX
1 intro
OOP programming
IntroToOOP.ppt
IntroToOOP.ppt
IntroToOOP.ppt
IntroToOOP.ppt
IntroT.ppt
IntroductionToObjectOrientedProgrammingLanguage
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Basics of object oriented programming interview tips for Java
OOP-1.pptx
Object oriented programming
oop.pptx
Intro to oop.pptx
Computer_Programming_Part_II_Segment_01.pdf
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
Introduction to oop with c++
Procedural-vs-Object-Oriented-Programming (1).pdf
Introduction to Object Oriented Programming.pptx
1 intro
Ad

More from Parameshwar Maddela (11)

PPTX
EventHandling in object oriented programming
PPTX
Exception‐Handling in object oriented programming
PPTX
working with interfaces in java programming
PPTX
introduction to object orinted programming through java
PPT
multhi threading concept in oops through java
PDF
Object oriented programming -QuestionBank
PPT
file handling in object oriented programming through java
PPTX
22H51A6755.pptx
PPTX
swings.pptx
PDF
03_Objects and Classes in java.pdf
PDF
02_Data Types in java.pdf
EventHandling in object oriented programming
Exception‐Handling in object oriented programming
working with interfaces in java programming
introduction to object orinted programming through java
multhi threading concept in oops through java
Object oriented programming -QuestionBank
file handling in object oriented programming through java
22H51A6755.pptx
swings.pptx
03_Objects and Classes in java.pdf
02_Data Types in java.pdf

Recently uploaded (20)

PPT
Drone Technology Electronics components_1
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PDF
classification of cubic lattice structure
PDF
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
PPTX
Road Safety tips for School Kids by a k maurya.pptx
PPT
Chapter 6 Design in software Engineeing.ppt
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PPTX
436813905-LNG-Process-Overview-Short.pptx
PPTX
Glazing at Facade, functions, types of glazing
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
TE-AI-Unit VI notes using planning model
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Ship’s Structural Components.pptx 7.7 Mb
PDF
International Journal of Information Technology Convergence and Services (IJI...
PPTX
Simulation of electric circuit laws using tinkercad.pptx
Drone Technology Electronics components_1
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
classification of cubic lattice structure
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
Road Safety tips for School Kids by a k maurya.pptx
Chapter 6 Design in software Engineeing.ppt
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
436813905-LNG-Process-Overview-Short.pptx
Glazing at Facade, functions, types of glazing
Strings in CPP - Strings in C++ are sequences of characters used to store and...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
TE-AI-Unit VI notes using planning model
Structs to JSON How Go Powers REST APIs.pdf
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Ship’s Structural Components.pptx 7.7 Mb
International Journal of Information Technology Convergence and Services (IJI...
Simulation of electric circuit laws using tinkercad.pptx

Intro tooop

  • 1. 1 INTRODUCTION TO OOP Objective: •Know the difference between functional programming and OOP • Know basic terminology in OOP • Know the importance of OOP • Know four design principles of OOP • Know OOP programming languages
  • 2. 2 STRUCTURED vs. OO PROGRAMMING STRUCTURED PROGRAMMING: MAIN PROGRAM FUNCTION 3 FUNCTION 2 GLOBAL DATA FUNCTION 5 FUNCTION 4 FUNCTION 1
  • 3. 3 Structured Programming Using function Function & program is divided into modules Every module has its own data and function which can be called by other modules.
  • 4. 4 OBJECT ORIENTED PROGRAMMING Object 1 Object 2 Data Function Data Function Object 3 Data Function
  • 5. 5 OBJECT ORIENTED PROGRAMMING Objects have both data and methods Objects of the same class have the same data elements and methods Objects send and receive messages to invoke actions Key idea in object-oriented: The real world can be accurately described as a collection of objects that interact.
  • 6. 6 Basic terminology object - usually a person, place or thing (a noun) method - an action performed by an object (a verb) attribute - description of objects in a class class - a category of similar objects (such as automobiles) - does not hold any values of the object’s attributes
  • 7. 7 Example for attributes and methods Attributes: manufacturer’s name model name year made color number of doors size of engine etc. Methods: Define data items (specify manufacturer’s name, model, year, etc.) Change a data item (color, engine, etc.) Display data items Calculate cost etc.
  • 8. 8 Why OOP? Save development time (and cost) by reusing code once an object class is created it can be used in other applications Easier debugging classes can be tested independently reused objects have already been tested
  • 9. 9 Design Principles of OOP Four main design principles of Object-Oriented Programming(OOP): Encapsulation Abstraction Polymorphism Inheritance
  • 10. 10 Encapsulation Also known as data hiding Only object’s methods can modify information in the object. Analogy: ATM machine can only update accounts of one person or object only.
  • 11. 11 Abstraction Focus only on the important facts about the problem at hand to design, produce, and describe so that it can be easily used without knowing the details of how it works. Analogy: When you drive a car, you don’t have to know how the gasoline and air are mixed and ignited. Instead you only have to know how to use the controls. Draw map
  • 12. 12 Polymorphism the same word or phrase can mean different things in different contexts Analogy: In English, bank can mean side of a river or a place to put money move -
  • 13. 13 Function Overloading The operation of one function depends on the argument passed to it. Example: Fly(), Fly(low), Fly(150)
  • 14. 14 Inheritance Inheritance—a way of organizing classes Term comes from inheritance of traits like eye color, hair color, and so on. Classes with properties in common can be grouped so that their common properties are only defined once. Superclass – inherit its attributes & methods to the subclass(es). Subclass – can inherit all its superclass attributes & methods besides having its own unique attributes & methods.
  • 15. 15 An Inheritance Hierarchy Vehicle Automobile Motorcycle Bus Sedan Sports Car School Bus Luxury Bus What properties does each vehicle inherit from the types of vehicles above it in the diagram? Superclass Subclasses
  • 16. 16 Object-Oriented Programming Languages  Pure OO Languages Smalltalk, Eiffel, Actor, Java  Hybrid OO Languages C++, Objective-C, Object-Pascal
  • 17. 17 Review: Introduction to Object Orientation What are the four basic principles of object orientation? Provide a brief description of each. What is an Object and what is a Class? What is the difference between them? What is an Attribute? What is an Operation? What is inheritance? What is polymorphism? Describe the strengths of object orientation.
  • 18. 18 Review: Introduction to Object Orientation State 2 differences between functional programming and OOP. What are the four basic principles of object orientation? Provide a brief description of each. What is an Object and what is a Class? What is the difference between them? What is an Attribute? What is an Operation? Describe the strengths of object orientation.