oop is not dead
TRANSCRIPT
![Page 1: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/1.jpg)
OOP is not Deador why we should stop seeing FP as its opponent or as silver bullet
Hernán A. Wilkinson
@hernanwilkinson
agile software development & services
![Page 2: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/2.jpg)
This will not be a war!
![Page 3: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/3.jpg)
A little bit of Context…
![Page 4: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/4.jpg)
![Page 5: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/5.jpg)
![Page 6: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/6.jpg)
A little bit of History…
![Page 7: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/7.jpg)
Structured Programming, when?
![Page 8: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/8.jpg)
![Page 9: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/9.jpg)
![Page 10: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/10.jpg)
![Page 11: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/11.jpg)
Object Oriented Programming, when?
![Page 12: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/12.jpg)
Simula 67Ole-Johan Dahl y Kristen Nygaard
![Page 13: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/13.jpg)
Simula 67Ole-Johan Dahl y Kristen Nygaard
![Page 14: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/14.jpg)
OOP before Structured Programming??
![Page 15: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/15.jpg)
![Page 16: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/16.jpg)
![Page 17: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/17.jpg)
![Page 18: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/18.jpg)
![Page 19: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/19.jpg)
![Page 20: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/20.jpg)
![Page 21: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/21.jpg)
Functional Programming, when?
![Page 22: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/22.jpg)
John McCarthy
![Page 23: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/23.jpg)
![Page 24: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/24.jpg)
![Page 25: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/25.jpg)
![Page 26: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/26.jpg)
What does make Lisp great?(always great! not, “great again” )
LISP
![Page 27: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/27.jpg)
(define (filtrar lista condicion)
(cond
((esta-vacia? lista) lista-vacia)
((condicion (primero-de lista)) (concatenar (primero-de lista) (filtrar (resto-de lista) condicion)))
(else (filtrar (resto-de lista) condicion))))
(filtrar ‘(1 4) (lambda (x) (< x 3)))
—> ‘(1)
(define smaller-than-three (lambda (x) (< x 3)))
(filtrar ‘(1 4) smaller-than-three)
—> ‘(1)
(define (smaller-than n) (lambda (x) (< x n)))
(filtrar ‘(1 4) (smaller-than 3))
—> ‘(1)
Lambda Functions
![Page 28: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/28.jpg)
Meta-Circular
![Page 29: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/29.jpg)
Meta-Circular
![Page 30: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/30.jpg)
Meta-Circular
![Page 31: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/31.jpg)
Meta-Circular
![Page 32: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/32.jpg)
Meta-Circular
![Page 33: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/33.jpg)
Dynamic! - REPL
![Page 34: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/34.jpg)
What is Object Oriented Programming?
![Page 35: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/35.jpg)
Alan Kay
![Page 36: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/36.jpg)
Dynabook (1970)
![Page 37: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/37.jpg)
![Page 38: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/38.jpg)
I invented the term
Object-Oriented and I
can tell you I did not
have C++ in mind.
Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS
![Page 39: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/39.jpg)
What is Object Oriented?
• MUST• Everything is an Object (data is an object, code is an object, classes are
objects, everything is an object!)
• Computation is done sending messages
• EITHER OR BOTH• Classes and Sub classification as means of knowledge organization
• Objects as prototypes as means of knowledge organization
• REALLY NICE TO HAVE • Immediate feedback
• Completely Reflective Environment (Meta-Circular)
![Page 40: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/40.jpg)
Dynamic! More than REPL, Inspectors!
![Page 41: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/41.jpg)
What OO is not• Data types - int, long, double, etc. They are not objects
• Statements - for, while, if, etc. They are not messages
• Static methods - There is no “self/this” on static methods
• Final/Seal methods – There is no message send when used
• When ”code” is not an Object – No Closure or no Lambda, i.e. Java previous 1.8
• JEE is no OO, it is structured programming in Java
• Anemic classes is not OO (Services with DTO, etc)
• Use of Inheritance for Code reuse is not good OO (i.e. ActiveRecord , white box frameworks, etc)
• Dependency Injection abuse is not OO
• IoC abuse is not OO
![Page 42: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/42.jpg)
This is not OO – Filter in Java
![Page 43: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/43.jpg)
What is Functional Programming?
![Page 44: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/44.jpg)
Wikipedia’s definition• […] treats computation as the evaluation of mathematical functions
and avoids changing-state and mutable data.
• It is a declarative programming paradigm, which means programming is done with expressions[…]instead of statements.
• Missing concepts from Wikipedia:• Lambda functions (which allow High Order functions)• Runtime support for recursive implementations (aka: tail recursion
elimination)
• Arguable: • Lazy evaluation (more or less)• Macro
![Page 45: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/45.jpg)
Good OO Design favors Immutable Objects!
![Page 46: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/46.jpg)
This is not OO!
![Page 47: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/47.jpg)
This IS OO!
![Page 48: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/48.jpg)
Real OO Languages represent “Code” as an object
(Closure High Order Functions)• Smalltalk since the ‘70s
• ”Closures got famous because Java don’t have them” (Anonymous)
![Page 49: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/49.jpg)
![Page 50: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/50.jpg)
Some conclusions - Good OO implies:
• Immutable objects when representing immutable entities
• Closure “High order functions”
• Message sending all the way (expressions)
• Consistency (everything is an object)
• Knowledge representation and classification(Programs are Models!)
![Page 51: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/51.jpg)
Some conclusions about FP
• It is a mistake to think that FP is going to solve all the software design problems.
• Design are made by humans, not by programming languages(even though they influence design decisions)
• FP will suffer from the same “miss-used” problems as OO suffers now
• FP does not provide a way to organize the knowledge represented in the software data structures are not enough, we know that from Structured Programming
![Page 52: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/52.jpg)
Some conclusions
•OOP vs. FP is an absurd dichotomy
•OOP and FP complement each other
•Do not act as a “Pop Programmer”
![Page 53: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/53.jpg)
From where “language programming paradigms shifts”
will come from?
![Page 54: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/54.jpg)
For sure NOT from
• Performance improvements
• Less verbose languages
• Better type system (other complete topic to discuss)
• It is “normal science” (khun-onian way to say “more of the same”)
![Page 55: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/55.jpg)
They will come from
• Better tools to help human-machine communication
• Better environments to “augment” human intellect
• More dynamic environments to improve immediate feedback
• …
• Let’s see some examples
![Page 56: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/56.jpg)
![Page 57: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/57.jpg)
![Page 58: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/58.jpg)
![Page 59: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/59.jpg)
For a new definition of
Programming Paradigm!
For better tools!
![Page 60: Oop is not Dead](https://reader034.vdocuments.us/reader034/viewer/2022051504/5a6689007f8b9ac5128b518b/html5/thumbnails/60.jpg)
agile software development & services
¡Gracias!