SlideShare a Scribd company logo
1 of 29
OOP History and Core
Concepts
Nghia Bui
katatunix@gmail.com
Nov 2017
2
What’s wrong with
OOP?
3
4
5
6
8
9
• So a lot of people are complaining about OOP
• And we are still sitting here to talk about
it???
9
Read more at:
http://www.yegor256.com/2016/08/15/what-
is-wrong-object-oriented-programming.html
The fact is that…
• Asking 10 people about what is OOP, received 11
answers, e.g.:
– “OOP is bundling data and functions together”
– “OOP is programming with classes and inheritance”
– “OOP is all about behavior”
– “OOP is all about message passing”
– “OOP is programming with abstraction, encapsulation,
polymorphism, and inheritance”
– …
10
The misuse of OOP
• OOP is just a tool in your programming toolbox
• Just like any tool, it can be misused
• OOP has been misused, both in academy and
industry:
– Focus too much on class inheritance: the strongest
relationship which encourages tight-coupling
– Abuse of mutable state: object state can change over
time (with, e.g., setter methods) unnecessarily
– Use god objects which defeat the purpose of objects:
breaking-down program into small and manageable
pieces called objects
11
OOP is actually a good tool
• Every tool is good if you know what it is!
• That’s why we – as software developers – still
need to learn OOP, but in a correct way!
12
OOP History
[1960s] Simula: the first OO lang
• Two Norwegians – Kristen
Nygaard and Ole-Johan Dahl –
working for the Norwegian
Defense research
• In 1960s they created Simula to
solve modeling problems:
– “They were working on simulations
that deal with exploding ships, and
realized they could group the ships
into different categories. Each ship
type would have its own class, and
the class would generate its unique
behavior and data. Simula was not
only responsible for introducing the
concept of a class, but it also
introduced the instance of a class.”
• Dahl–Nygaard Prize
14
Story: http://www.exforsys.com/tutorials/oops-concepts/the-history-of-object-oriented-programming.html
Image: http://web.cecs.pdx.edu/~black/publications/O-JDahl.pdf
[1970s] Smalltalk: the purist OO lang
• The term OOP was first used by
Alan Kay at Xerox PARC in their
Smalltalk language
• The term was used to refer to
the process of using objects as
the foundation for computation
• The Smalltalk team was
inspired by the Simula project,
but they designed Smalltalk so
that it would be dynamic
• Purist:
– Everything is an object
– No primitive types (int, float…)
– Message-passing style, not
method-invocation style
15
Since then…
1983: Bjarne
Stroustrup
ported the ideas
of Simula to C
to support
simulation
programming 
“C with classes”
 C++
1984: Brad Cox
added
Smalltalk-style
message-
passing syntax
to C and called
it “Objective-C”
1995: Java –
created by
James Gosling –
integrated
implementation
technology from
Smalltalk and
syntax from C++
2000: C# is the
main language
of the .NET
platform from
Microsoft, it
was created by
Anders
Hejlsberg, the
most recent
version is C# 7.1
16
Not to mention JavaScript, Ruby, Python…
OOP Motivation and
Core Concepts
In this section, only the core, essential, and general concepts
of OOP are discussed, language concepts are ignored
Behaviors and Data
• All software are about behaviors (*) operating on data,
regardless the paradigm (Procedural/OO/Functional)
• Data has concepts of:
– “type” (or “structure”)
– “value” (or “state”)
• To operate on data, a behavior must:
– understand the structure of the data
– have ability of accessing/modifying/creating/deleting the
state of the data
• Behavior A can make use of (interact with) behavior B
18
(*) you can think behaviors as functions/procedures, here I want to avoid
using such language-specific terms, the term “behaviors” is more general
Procedural programming (PP):
data and behaviors are separated
19
• The Person struct is
likely to be used in
many places
• Those places may
accidentally change
the state of the
person data
• When the structure
of Person changes, all
of those places are
affected
 PROBLEM: data are
used in large scopes
 But it’s not the fault
of PP, it’s a matter of
discipline
The solution/discipline of OOP
• Data must be used in a small scope called object
• Only the object has the direct access to its
(internal) data
• The outside interacts with the object A by using
the behavior exposed/provided by A
• Objects know about each other through
behaviors, and make use of those behaviors by
interacting/communicating
• When decomposing program into objects, only
behaviors matter, data don’t
20
OOP is all about behaviors!
• Each object has one behavior
• A behavior = a set of parameterized
operations
• An object is recognized by its behavior, not its
data
21
The 4 characteristics of behaviors
• the behavior of an object is its abstraction
Abstraction
• the behavior of an object encapsulates (hides) its (internal) details
Encapsulation
• behaviors are polymorphic
Polymorphism
• behaviors are inheritable
Inheritance
22
Abstraction
• The behavior of an object is its abstraction
• The abstraction of an object is:
– the most essential thing of that object
– the most impressive thing of that object
– stable / unlikely to change
• Finding the right abstractions (i.e., correct
behaviors) of objects is the key to programming
with OO:
– The right abs depends on the domain/app
– What if we find the wrong abs?
• Wrong abs are likely to change
23
Encapsulation
• The behavior of an object encapsulates (hides)
its (internal) details
• Those details contain not only data but also
everything that needs to be hidden
• Abstraction and encapsulation are very closed:
– To achieve abstraction, we need encapsulation
– When we do encapsulation, we have abstraction
• Anyway, both of them are the heart of OOP
• They are really good for managing the complicity
of software
24
Polymorphism
• Behaviors are polymorphic
• If an object a works with object b:
– class A {void test(b){/*work with b*/}}
– class A {
private b;
A(b) { this.b = b; }
void test() {/*work with this.b*/}
}
• Then we can pass any object c behaving like b to
a and a still works well
• Benefit: Flexibility  Reusability
25
This technique is called
“dependency injection”
Inheritance
• Behaviors are inheritable
• If we have an object a has a behavior with 2
operations x() and y()
• Then there is a way to create an object b having
those 2 operations, and optionally with extra
customizations e.g.:
– adding operation z()
– removing operation x()
– overriding operation y()
• Benefit: Reusability
26
Not all languages
support this
Inheritance controversy
• In its essence, there is nothing wrong about
inheritance:
– It is a way to create objects having the same
behaviors to existing objects with optional
customizations
• So where does the controversy come from?
– Different languages have different ways to implement
object creation
– Thus, inheritance is implemented in very different
ways, some ways are even different from the essence
– Class inheritance in class-based & statically-typed
languages is the problematic one; sadly, these
languages are the most popular OOP languages
27
OOP key notes
• Using behaviors as the basis of abstraction is the
key of OOP.
• When a concept is abstracted and encapsulated
by a polymorphic behavior, we call it an object.
• When we program / design by defining objects,
creating objects and letting them interact in
order to achieve dedicated tasks, we call it
object-oriented programming / design.
28
Core concept vs. language concepts
Core
• Object, Behavior, Operation, Parameterized Operation,
Interaction, Communication, Abstraction, Encapsulation,
Polymorphism, Inheritance
Lang
• Type, Class, Struct, Method, Property, Interface, Abstract Class,
Public, Private, Protected, Method Overriding/Overloading,
Virtual Method, Class Inheritance, Exception, Static
Method/Property, Generic Type…
• Class-based Style, Prototype-based Style
• Static Typing, Dynamic Typing
29

More Related Content

What's hot

Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
Serialization & De-serialization in Java
Serialization & De-serialization in JavaSerialization & De-serialization in Java
Serialization & De-serialization in JavaInnovationM
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Courseparveen837153
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Michelle Anne Meralpis
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)Ishin Vin
 
Introduction to kotlin coroutines
Introduction to kotlin coroutinesIntroduction to kotlin coroutines
Introduction to kotlin coroutinesNAVER Engineering
 
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしようYasuhiro Yoshimura
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹Johnny Sung
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced JavascriptAdieu
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentationritika1
 
Unit 4 final
Unit 4 finalUnit 4 final
Unit 4 finalsietkcse
 
SystemC Tutorial
SystemC TutorialSystemC Tutorial
SystemC Tutorialkocha2012
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - PolymorphismOum Saokosal
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 

What's hot (20)

Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
Serialization & De-serialization in Java
Serialization & De-serialization in JavaSerialization & De-serialization in Java
Serialization & De-serialization in Java
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Course
 
Php
PhpPhp
Php
 
Java collections
Java collectionsJava collections
Java collections
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Introduction to kotlin coroutines
Introduction to kotlin coroutinesIntroduction to kotlin coroutines
Introduction to kotlin coroutines
 
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう
【関東GPGPU勉強会#3】OpenCVの新機能 UMatを先取りしよう
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Unicode basics in python
Unicode basics in pythonUnicode basics in python
Unicode basics in python
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
Unit 4 final
Unit 4 finalUnit 4 final
Unit 4 final
 
SystemC Tutorial
SystemC TutorialSystemC Tutorial
SystemC Tutorial
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
 
Nodejs buffers
Nodejs buffersNodejs buffers
Nodejs buffers
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 

Similar to OOP History and Core Concepts

introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programmingRiturajJain8
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptxUmerUmer25
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programmingSaket Khopkar
 
Intro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-CIntro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-CAndrew Rohn
 
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.pptsagarjsicg
 
M01_OO_Intro.ppt
M01_OO_Intro.pptM01_OO_Intro.ppt
M01_OO_Intro.pptRojaPogul1
 
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptHistory of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptathar549116
 
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptHistory of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptMuhammad Athar
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programmingAbzetdin Adamov
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Nuzhat Memon
 
1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).pptAqeelAbbas94
 
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaTeaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaDr. Sandeep Kumar Singh
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals umesh patil
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesJessica Deakin
 
Computer Science ACW Intro to OOP L7.pptx
Computer Science ACW Intro to OOP L7.pptxComputer Science ACW Intro to OOP L7.pptx
Computer Science ACW Intro to OOP L7.pptxEdmondLabule2
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iTaymoor Nazmy
 

Similar to OOP History and Core Concepts (20)

introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programming
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
 
Intro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-CIntro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-C
 
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
1. OBJECT ORIENTED PROGRAMMING USING JAVA - OOps Concepts.ppt
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
M01_OO_Intro.ppt
M01_OO_Intro.pptM01_OO_Intro.ppt
M01_OO_Intro.ppt
 
Oop
OopOop
Oop
 
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptHistory of Object Orientation in OOP.ppt
History of Object Orientation in OOP.ppt
 
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.pptHistory of Object Orientation in OOP.ppt
History of Object Orientation in OOP.ppt
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
 
1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt1-Lec - Introduction vhvv,vbvv,v (2).ppt
1-Lec - Introduction vhvv,vbvv,v (2).ppt
 
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaTeaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
 
Oops and c fundamentals
Oops and c fundamentals Oops and c fundamentals
Oops and c fundamentals
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
 
Computer Science ACW Intro to OOP L7.pptx
Computer Science ACW Intro to OOP L7.pptxComputer Science ACW Intro to OOP L7.pptx
Computer Science ACW Intro to OOP L7.pptx
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-i
 

Recently uploaded

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 

Recently uploaded (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 

OOP History and Core Concepts

  • 1. OOP History and Core Concepts Nghia Bui katatunix@gmail.com Nov 2017
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. 8
  • 8. 9
  • 9. • So a lot of people are complaining about OOP • And we are still sitting here to talk about it??? 9 Read more at: http://www.yegor256.com/2016/08/15/what- is-wrong-object-oriented-programming.html
  • 10. The fact is that… • Asking 10 people about what is OOP, received 11 answers, e.g.: – “OOP is bundling data and functions together” – “OOP is programming with classes and inheritance” – “OOP is all about behavior” – “OOP is all about message passing” – “OOP is programming with abstraction, encapsulation, polymorphism, and inheritance” – … 10
  • 11. The misuse of OOP • OOP is just a tool in your programming toolbox • Just like any tool, it can be misused • OOP has been misused, both in academy and industry: – Focus too much on class inheritance: the strongest relationship which encourages tight-coupling – Abuse of mutable state: object state can change over time (with, e.g., setter methods) unnecessarily – Use god objects which defeat the purpose of objects: breaking-down program into small and manageable pieces called objects 11
  • 12. OOP is actually a good tool • Every tool is good if you know what it is! • That’s why we – as software developers – still need to learn OOP, but in a correct way! 12
  • 14. [1960s] Simula: the first OO lang • Two Norwegians – Kristen Nygaard and Ole-Johan Dahl – working for the Norwegian Defense research • In 1960s they created Simula to solve modeling problems: – “They were working on simulations that deal with exploding ships, and realized they could group the ships into different categories. Each ship type would have its own class, and the class would generate its unique behavior and data. Simula was not only responsible for introducing the concept of a class, but it also introduced the instance of a class.” • Dahl–Nygaard Prize 14 Story: http://www.exforsys.com/tutorials/oops-concepts/the-history-of-object-oriented-programming.html Image: http://web.cecs.pdx.edu/~black/publications/O-JDahl.pdf
  • 15. [1970s] Smalltalk: the purist OO lang • The term OOP was first used by Alan Kay at Xerox PARC in their Smalltalk language • The term was used to refer to the process of using objects as the foundation for computation • The Smalltalk team was inspired by the Simula project, but they designed Smalltalk so that it would be dynamic • Purist: – Everything is an object – No primitive types (int, float…) – Message-passing style, not method-invocation style 15
  • 16. Since then… 1983: Bjarne Stroustrup ported the ideas of Simula to C to support simulation programming  “C with classes”  C++ 1984: Brad Cox added Smalltalk-style message- passing syntax to C and called it “Objective-C” 1995: Java – created by James Gosling – integrated implementation technology from Smalltalk and syntax from C++ 2000: C# is the main language of the .NET platform from Microsoft, it was created by Anders Hejlsberg, the most recent version is C# 7.1 16 Not to mention JavaScript, Ruby, Python…
  • 17. OOP Motivation and Core Concepts In this section, only the core, essential, and general concepts of OOP are discussed, language concepts are ignored
  • 18. Behaviors and Data • All software are about behaviors (*) operating on data, regardless the paradigm (Procedural/OO/Functional) • Data has concepts of: – “type” (or “structure”) – “value” (or “state”) • To operate on data, a behavior must: – understand the structure of the data – have ability of accessing/modifying/creating/deleting the state of the data • Behavior A can make use of (interact with) behavior B 18 (*) you can think behaviors as functions/procedures, here I want to avoid using such language-specific terms, the term “behaviors” is more general
  • 19. Procedural programming (PP): data and behaviors are separated 19 • The Person struct is likely to be used in many places • Those places may accidentally change the state of the person data • When the structure of Person changes, all of those places are affected  PROBLEM: data are used in large scopes  But it’s not the fault of PP, it’s a matter of discipline
  • 20. The solution/discipline of OOP • Data must be used in a small scope called object • Only the object has the direct access to its (internal) data • The outside interacts with the object A by using the behavior exposed/provided by A • Objects know about each other through behaviors, and make use of those behaviors by interacting/communicating • When decomposing program into objects, only behaviors matter, data don’t 20
  • 21. OOP is all about behaviors! • Each object has one behavior • A behavior = a set of parameterized operations • An object is recognized by its behavior, not its data 21
  • 22. The 4 characteristics of behaviors • the behavior of an object is its abstraction Abstraction • the behavior of an object encapsulates (hides) its (internal) details Encapsulation • behaviors are polymorphic Polymorphism • behaviors are inheritable Inheritance 22
  • 23. Abstraction • The behavior of an object is its abstraction • The abstraction of an object is: – the most essential thing of that object – the most impressive thing of that object – stable / unlikely to change • Finding the right abstractions (i.e., correct behaviors) of objects is the key to programming with OO: – The right abs depends on the domain/app – What if we find the wrong abs? • Wrong abs are likely to change 23
  • 24. Encapsulation • The behavior of an object encapsulates (hides) its (internal) details • Those details contain not only data but also everything that needs to be hidden • Abstraction and encapsulation are very closed: – To achieve abstraction, we need encapsulation – When we do encapsulation, we have abstraction • Anyway, both of them are the heart of OOP • They are really good for managing the complicity of software 24
  • 25. Polymorphism • Behaviors are polymorphic • If an object a works with object b: – class A {void test(b){/*work with b*/}} – class A { private b; A(b) { this.b = b; } void test() {/*work with this.b*/} } • Then we can pass any object c behaving like b to a and a still works well • Benefit: Flexibility  Reusability 25 This technique is called “dependency injection”
  • 26. Inheritance • Behaviors are inheritable • If we have an object a has a behavior with 2 operations x() and y() • Then there is a way to create an object b having those 2 operations, and optionally with extra customizations e.g.: – adding operation z() – removing operation x() – overriding operation y() • Benefit: Reusability 26 Not all languages support this
  • 27. Inheritance controversy • In its essence, there is nothing wrong about inheritance: – It is a way to create objects having the same behaviors to existing objects with optional customizations • So where does the controversy come from? – Different languages have different ways to implement object creation – Thus, inheritance is implemented in very different ways, some ways are even different from the essence – Class inheritance in class-based & statically-typed languages is the problematic one; sadly, these languages are the most popular OOP languages 27
  • 28. OOP key notes • Using behaviors as the basis of abstraction is the key of OOP. • When a concept is abstracted and encapsulated by a polymorphic behavior, we call it an object. • When we program / design by defining objects, creating objects and letting them interact in order to achieve dedicated tasks, we call it object-oriented programming / design. 28
  • 29. Core concept vs. language concepts Core • Object, Behavior, Operation, Parameterized Operation, Interaction, Communication, Abstraction, Encapsulation, Polymorphism, Inheritance Lang • Type, Class, Struct, Method, Property, Interface, Abstract Class, Public, Private, Protected, Method Overriding/Overloading, Virtual Method, Class Inheritance, Exception, Static Method/Property, Generic Type… • Class-based Style, Prototype-based Style • Static Typing, Dynamic Typing 29