SlideShare a Scribd company logo
ICS 313 - Fundamentals of Programming Languages 1
12. Object-Oriented Programming
12.1 Introduction
Categories of languages that support OOP:
1. OOP support is added to an existing language
C++ (also supports procedural and data-oriented programming)
Ada 95 (also supports procedural and data-oriented programming)
CLOS (also supports functional programming)
Scheme (also supports functional programming)
2. Support OOP, but have the same appearance and use the basic
structure of earlier imperative languages
Eiffel (not based directly on any previous language)
Java (based on C++)
3. Pure OOP languages
Smalltalk
ICS 313 - Fundamentals of Programming Languages 2
12.2 Object-Oriented Programming
Paradigm Evolution
1. Procedural - 1950s-1970s (procedural abstraction)
2. Data-Oriented - early 1980s (data abstraction)
3. OOP - late 1980s (Inheritance and dynamic binding)
Origins of Inheritance
Observations of the mid-late 1980s :
Productivity increases can come from reuse
Unfortunately, ADTs are difficult to reuse - never quite right
All ADTs are independent and at the same level
Inheritance solves both - reuse ADTs after minor
changes and define classes in a hierarchy
12.2 Object-Oriented Programming (continued)
OOP Definitions:
ADTs are called classes
Class instances are called objects
A class that inherits is a derived class or a subclass
The class from which another class inherits is a parent class or
superclass
Subprograms that define operations on objects are called
methods
The entire collection of methods of an object is called its
message protocol or message interface
Messages have two parts - a method name and the destination
object
In the simplest case, a class inherits all of the entities of its
parent
ICS 313 - Fundamentals of Programming Languages 3
12.2 Object-Oriented Programming (continued)
Inheritance can be complicated by access controls to encapsulated entities
A class can hide entities from its subclasses
A class can hide entities from its clients
A class can also hide entities for its clients while allowing its subclasses to see them
Besides inheriting methods as is, a class can modify an inherited method
The new one overrides the inherited one
The method in the parent is overriden
There are two kinds of variables in a class:
1. Class variables - one/class
2. Instance variables - one/object
There are two kinds of methods in a class:
1. Class methods – accept messages to the class
2. Instance methods – accept messages to objects
Single vs. Multiple Inheritance
One disadvantage of inheritance for reuse:
Creates interdependencies among classes that complicate maintenance
12.2 Object-Oriented Programming (continued)
Polymorphism in OOPLs
A polymorphic variable can be defined in a class that is able to
reference (or point to) objects of the class and objects of any of
its descendants
When a class hierarchy includes classes that override methods
and such methods are called through a polymorphic variable,
the binding to the correct method MUST be dynamic
This polymorphism simplifies the addition of new methods
A virtual method is one that does not include a definition (it only
defines a protocol)
A virtual class is one that includes at least one virtual method
A virtual class cannot be instantiated
ICS 313 - Fundamentals of Programming Languages 4
12.2 Object-Oriented Programming (continued)
Design Issues for OOPLs
1. The Exclusivity of Objects
a. Everything is an object
Advantage - elegance and purity
Disadvantage - slow operations on simple objects (e.g., float)
b. Add objects to a complete typing system
Advantage - fast operations on simple objects
Disadvantage - results in a confusing type system (two kinds of entities)
c. Include an imperative-style typing system for primitives but
make everything else objects
Advantage - fast operations on simple objects and a relatively small typing system
Disadvantage - still some confusion because of the two type systems
2. Are Subclasses Subtypes?
Does an is-a relationship hold between a parent class object
and an object of the subclass?
12.2 Object-Oriented Programming (continued)
3. Implementation and Interface Inheritance
If only the interface of the parent class is visible to the subclass,
it is interface inheritance
Disadvantage - can result in inefficiencies
If both the interface and the implementation of the parent class
is visible to the subclass, it is implementation inheritance
Disadvantage - changes to the parent class require recompilation of subclasses, and
sometimes even modification of subclasses
4. Type Checking and Polymorphism
Polymorphism may require dynamic type checking of
parameters and the return value
Dynamic type checking is costly and delays error detection
If overriding methods are restricted to having the same
parameter types and return type, the checking can be static
ICS 313 - Fundamentals of Programming Languages 5
12.2 Object-Oriented Programming (continued)
5. Single and Multiple Inheritance
Disadvantages of multiple inheritance:
Language and implementation complexity (in part due to name collisions)
Potential inefficiency - dynamic binding costs more with multiple inheritance (but not much)
Advantage:
Sometimes it is extremely convenient and valuable
6. Allocation and Deallocation of Objects
From where are objects allocated?
If they all live in the heap, references to them are uniform
Simplifies assignment - dereferencing can be implicit
Is deallocation explicit or implicit?
7. Dynamic and Static Binding
Should ALL binding of messages to methods be dynamic?
If none are, you lose the advantages of dynamic binding
If all are, it is inefficient

More Related Content

What's hot

Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
biswajit2015
 
Java interface
Java interface Java interface
Java interface
HoneyChintal
 
C#, OOP introduction and examples
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examples
agni_agbc
 
Object Orinted Programing(OOP) concepts \
Object Orinted Programing(OOP) concepts \Object Orinted Programing(OOP) concepts \
Object Orinted Programing(OOP) concepts \
Pritom Chaki
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
Jeba Moses
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Lovely Professional University
 
Ppt chapter06
Ppt chapter06Ppt chapter06
Ppt chapter06
Richard Styner
 
Object Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsObject Oriented Programming - Basic Concepts
Object Oriented Programming - Basic Concepts
Arunkumar Kupppuswamy
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
talha ijaz
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5prakash185645
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
Study Stuff
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
Elizabeth alexander
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Raffi Khatchadourian
 

What's hot (20)

Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
 
Java interface
Java interface Java interface
Java interface
 
C#, OOP introduction and examples
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examples
 
Object Orinted Programing(OOP) concepts \
Object Orinted Programing(OOP) concepts \Object Orinted Programing(OOP) concepts \
Object Orinted Programing(OOP) concepts \
 
Csci360 20
Csci360 20Csci360 20
Csci360 20
 
Csci360 20 (1)
Csci360 20 (1)Csci360 20 (1)
Csci360 20 (1)
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Unit 4 Java
Unit 4 JavaUnit 4 Java
Unit 4 Java
 
Ppt chapter06
Ppt chapter06Ppt chapter06
Ppt chapter06
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Object Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsObject Oriented Programming - Basic Concepts
Object Oriented Programming - Basic Concepts
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Inheritance
InheritanceInheritance
Inheritance
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
 

Viewers also liked

Presentación normas cacería
Presentación normas caceríaPresentación normas cacería
Presentación normas cacería
esc_vicenteferrer
 
Proporción nn Procesos Productivos
Proporción nn Procesos ProductivosProporción nn Procesos Productivos
Proporción nn Procesos Productivosguestf83d576
 
sexe
sexesexe
sexe
sexesexe
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
Janaina Xavier
 
Jf 17
Jf 17Jf 17
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap AborsiMasail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
Haristian Sahroni Putra
 
Raji_new_July_2015
Raji_new_July_2015Raji_new_July_2015
Raji_new_July_2015Raja Kumari
 
Objetos que forman diferentes tipos de ángulos
Objetos que forman diferentes tipos de ángulosObjetos que forman diferentes tipos de ángulos
Objetos que forman diferentes tipos de ángulos
Olivia Galván
 
తెలుగు అచ్చులు (Telugu Achulu)
తెలుగు అచ్చులు (Telugu Achulu)తెలుగు అచ్చులు (Telugu Achulu)
తెలుగు అచ్చులు (Telugu Achulu)
NaaBadi PCnu
 

Viewers also liked (14)

Presentación normas cacería
Presentación normas caceríaPresentación normas cacería
Presentación normas cacería
 
February wk 2
February wk 2February wk 2
February wk 2
 
Castravete ciupirea plantei
Castravete ciupirea planteiCastravete ciupirea plantei
Castravete ciupirea plantei
 
Proporción nn Procesos Productivos
Proporción nn Procesos ProductivosProporción nn Procesos Productivos
Proporción nn Procesos Productivos
 
1804.13
1804.131804.13
1804.13
 
sexe
sexesexe
sexe
 
Server Networking
Server NetworkingServer Networking
Server Networking
 
sexe
sexesexe
sexe
 
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
01 c ce-–-andaime-fachadeiro-–-manual-de-montagem
 
Jf 17
Jf 17Jf 17
Jf 17
 
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap AborsiMasail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
Masail Fiqhiyyah - Makalah Pandangan Hukum Islam Terhadap Aborsi
 
Raji_new_July_2015
Raji_new_July_2015Raji_new_July_2015
Raji_new_July_2015
 
Objetos que forman diferentes tipos de ángulos
Objetos que forman diferentes tipos de ángulosObjetos que forman diferentes tipos de ángulos
Objetos que forman diferentes tipos de ángulos
 
తెలుగు అచ్చులు (Telugu Achulu)
తెలుగు అచ్చులు (Telugu Achulu)తెలుగు అచ్చులు (Telugu Achulu)
తెలుగు అచ్చులు (Telugu Achulu)
 

Similar to 12 object oriented programming

Unit 3
Unit 3Unit 3
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr Jun-jun Lagman
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basicsvamshimahi
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
Satyam Jaiswal
 
C#
C#C#
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
Ranjith Sekar
 
core_java.ppt
core_java.pptcore_java.ppt
core_java.ppt
YashikaDave
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
cesarmendez78
 
12th ip CBSE chapter 4 oop in java notes complete
12th ip CBSE  chapter 4 oop in java notes complete12th ip CBSE  chapter 4 oop in java notes complete
12th ip CBSE chapter 4 oop in java notes complete
Harish Gyanani
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Madhavendra Dutt
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
Shashwat Shriparv
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
Garuda Trainings
 
Polymorphism
PolymorphismPolymorphism
PolymorphismKumar
 
Java Notes
Java NotesJava Notes
Java Notes
Abhishek Khune
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
Md.Al-imran Roton
 
JavaHTP6e_10.ppt
JavaHTP6e_10.pptJavaHTP6e_10.ppt
JavaHTP6e_10.ppt
AmineAbdellatif1
 

Similar to 12 object oriented programming (20)

Oop
OopOop
Oop
 
Unit 3
Unit 3Unit 3
Unit 3
 
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
C#
C#C#
C#
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
core_java.ppt
core_java.pptcore_java.ppt
core_java.ppt
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
12th ip CBSE chapter 4 oop in java notes complete
12th ip CBSE  chapter 4 oop in java notes complete12th ip CBSE  chapter 4 oop in java notes complete
12th ip CBSE chapter 4 oop in java notes complete
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Java Notes
Java NotesJava Notes
Java Notes
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
JavaHTP6e_10.ppt
JavaHTP6e_10.pptJavaHTP6e_10.ppt
JavaHTP6e_10.ppt
 

More from jigeno

Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1
jigeno
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
jigeno
 
16 logical programming
16 logical programming16 logical programming
16 logical programmingjigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
14 exception handling
14 exception handling14 exception handling
14 exception handlingjigeno
 
13 concurrency
13 concurrency13 concurrency
13 concurrencyjigeno
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data typesjigeno
 
9 subprograms
9 subprograms9 subprograms
9 subprogramsjigeno
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structurejigeno
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statementsjigeno
 
6 data types
6 data types6 data types
6 data typesjigeno
 
5 names
5 names5 names
5 namesjigeno
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysisjigeno
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semanticsjigeno
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languagesjigeno
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminariesjigeno
 
Access2007 m2
Access2007 m2Access2007 m2
Access2007 m2jigeno
 
Access2007 m1
Access2007 m1Access2007 m1
Access2007 m1jigeno
 

More from jigeno (20)

Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
 
Bsit1
Bsit1Bsit1
Bsit1
 
16 logical programming
16 logical programming16 logical programming
16 logical programming
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
13 concurrency
13 concurrency13 concurrency
13 concurrency
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 
9 subprograms
9 subprograms9 subprograms
9 subprograms
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
 
6 data types
6 data types6 data types
6 data types
 
5 names
5 names5 names
5 names
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysis
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semantics
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languages
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminaries
 
Access2007 m2
Access2007 m2Access2007 m2
Access2007 m2
 
Access2007 m1
Access2007 m1Access2007 m1
Access2007 m1
 

Recently uploaded

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

12 object oriented programming

  • 1. ICS 313 - Fundamentals of Programming Languages 1 12. Object-Oriented Programming 12.1 Introduction Categories of languages that support OOP: 1. OOP support is added to an existing language C++ (also supports procedural and data-oriented programming) Ada 95 (also supports procedural and data-oriented programming) CLOS (also supports functional programming) Scheme (also supports functional programming) 2. Support OOP, but have the same appearance and use the basic structure of earlier imperative languages Eiffel (not based directly on any previous language) Java (based on C++) 3. Pure OOP languages Smalltalk
  • 2. ICS 313 - Fundamentals of Programming Languages 2 12.2 Object-Oriented Programming Paradigm Evolution 1. Procedural - 1950s-1970s (procedural abstraction) 2. Data-Oriented - early 1980s (data abstraction) 3. OOP - late 1980s (Inheritance and dynamic binding) Origins of Inheritance Observations of the mid-late 1980s : Productivity increases can come from reuse Unfortunately, ADTs are difficult to reuse - never quite right All ADTs are independent and at the same level Inheritance solves both - reuse ADTs after minor changes and define classes in a hierarchy 12.2 Object-Oriented Programming (continued) OOP Definitions: ADTs are called classes Class instances are called objects A class that inherits is a derived class or a subclass The class from which another class inherits is a parent class or superclass Subprograms that define operations on objects are called methods The entire collection of methods of an object is called its message protocol or message interface Messages have two parts - a method name and the destination object In the simplest case, a class inherits all of the entities of its parent
  • 3. ICS 313 - Fundamentals of Programming Languages 3 12.2 Object-Oriented Programming (continued) Inheritance can be complicated by access controls to encapsulated entities A class can hide entities from its subclasses A class can hide entities from its clients A class can also hide entities for its clients while allowing its subclasses to see them Besides inheriting methods as is, a class can modify an inherited method The new one overrides the inherited one The method in the parent is overriden There are two kinds of variables in a class: 1. Class variables - one/class 2. Instance variables - one/object There are two kinds of methods in a class: 1. Class methods – accept messages to the class 2. Instance methods – accept messages to objects Single vs. Multiple Inheritance One disadvantage of inheritance for reuse: Creates interdependencies among classes that complicate maintenance 12.2 Object-Oriented Programming (continued) Polymorphism in OOPLs A polymorphic variable can be defined in a class that is able to reference (or point to) objects of the class and objects of any of its descendants When a class hierarchy includes classes that override methods and such methods are called through a polymorphic variable, the binding to the correct method MUST be dynamic This polymorphism simplifies the addition of new methods A virtual method is one that does not include a definition (it only defines a protocol) A virtual class is one that includes at least one virtual method A virtual class cannot be instantiated
  • 4. ICS 313 - Fundamentals of Programming Languages 4 12.2 Object-Oriented Programming (continued) Design Issues for OOPLs 1. The Exclusivity of Objects a. Everything is an object Advantage - elegance and purity Disadvantage - slow operations on simple objects (e.g., float) b. Add objects to a complete typing system Advantage - fast operations on simple objects Disadvantage - results in a confusing type system (two kinds of entities) c. Include an imperative-style typing system for primitives but make everything else objects Advantage - fast operations on simple objects and a relatively small typing system Disadvantage - still some confusion because of the two type systems 2. Are Subclasses Subtypes? Does an is-a relationship hold between a parent class object and an object of the subclass? 12.2 Object-Oriented Programming (continued) 3. Implementation and Interface Inheritance If only the interface of the parent class is visible to the subclass, it is interface inheritance Disadvantage - can result in inefficiencies If both the interface and the implementation of the parent class is visible to the subclass, it is implementation inheritance Disadvantage - changes to the parent class require recompilation of subclasses, and sometimes even modification of subclasses 4. Type Checking and Polymorphism Polymorphism may require dynamic type checking of parameters and the return value Dynamic type checking is costly and delays error detection If overriding methods are restricted to having the same parameter types and return type, the checking can be static
  • 5. ICS 313 - Fundamentals of Programming Languages 5 12.2 Object-Oriented Programming (continued) 5. Single and Multiple Inheritance Disadvantages of multiple inheritance: Language and implementation complexity (in part due to name collisions) Potential inefficiency - dynamic binding costs more with multiple inheritance (but not much) Advantage: Sometimes it is extremely convenient and valuable 6. Allocation and Deallocation of Objects From where are objects allocated? If they all live in the heap, references to them are uniform Simplifies assignment - dereferencing can be implicit Is deallocation explicit or implicit? 7. Dynamic and Static Binding Should ALL binding of messages to methods be dynamic? If none are, you lose the advantages of dynamic binding If all are, it is inefficient