Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Oops! OOP's Not What I Thought

Oops! OOP's Not What I Thought

(Presented at Øredev 2018, DomCode 2016)

In this talk we'll go on a historical and philosophical journey deep into the heart of object-oriented programming (OOP). Come along with me as I have my world shaken by the discovery that objects and classes are not the most important concepts in OOP: messages and late binding are. Join me as we try to peek inside the heads of Alan Kay and the other founders of the paradigm as they were developing early object-oriented languages like Smalltalk, only to discover that those "old" ideas seem strikingly relevant today. We may even feel our jaws drop as we realize that OOP and functional programming are not as different as we may have thought, and that the first object-oriented language was not created in the 60's or 70's but much, much earlier…

What awaits us at the end of this journey? At worst, we'll experience a brief crisis of faith in everything we ever thought we knew about programming. (A support group will meet after the conference.) At best, we'll shift the way we view this near-ubiquitous but oft-misunderstood programming paradigm, and walk away with new insights for how we architect and understand our code.

Anjana Sofia Vakil

November 04, 2016
Tweet

More Decks by Anjana Sofia Vakil

Other Decks in Programming

Transcript

  1. @AnjanaVakil hi, I’m Anjana! - philosophy grad - English language

    teacher - computational linguist - software developer
  2. @AnjanaVakil Photo by Marcin Wichary from San Francisco, U.S.A. (Alan

    Kay and the prototype of Dynabook, pt. 5) [CC BY 2.0 (http://creativecommons.org/licenses/by/2.0)], via Wikimedia Commons Alan Kay @AnjanaVakil
  3. @AnjanaVakil object- oriented “Slide of the Week: Increased WBC, April

    14, 2011” via Center for Genomic Pathology (http://ctrgenpath.net/wp-content/uploads/2011/04/cml02.jpg) @AnjanaVakil
  4. @AnjanaVakil Alan Kay “I'm sorry that I long ago coined

    the term "objects" for this topic because it gets many people to focus on the lesser idea. @AnjanaVakil
  5. @AnjanaVakil Alan Kay “The big idea is "messaging"” - To

    Smalltalk/Squeak mailing list, 1998 wiki.c2.com/?AlanKayOnMessaging @AnjanaVakil
  6. @AnjanaVakil messages “Dopamine D3 receptor” via Orientation of Proteins in

    Membranes Database (http://opm.phar.umich.edu/images/png/3pbl.png) @AnjanaVakil
  7. @AnjanaVakil systems Image by The Opte Project (Internet Map) [CC

    BY 2.5 (http://creativecommons.org/licenses/by/2.5)], via Wikimedia Commons @AnjanaVakil
  8. @AnjanaVakil class Friend: def __init__(self, friends): self.friends = friends def

    is_friend_of(self, name): return name in self.friends buddy = Friend(['alan', 'alonzo']) buddy.is_friend_of('guy') => False
  9. @AnjanaVakil def Friend(friend_names): my_friends = friend_names def is_my_friend(name): return name

    in friend_names def responder(method_name, *args): if method_name == 'is_friend_of': return is_my_friend(args) return responder buddy = Friend(['alan', 'alonzo']) buddy('is_friend_of','guy') => False
  10. @AnjanaVakil def Friend(friend_names): my_friends = friend_names def is_my_friend(name): return name

    in friend_names def buddy(method_name, *args): if method_name == 'is_friend_of': return is_my_friend(*args) return responder buddy = Friend(['alan', 'alonzo']) buddy('is_friend_of','guy') => False
  11. @AnjanaVakil def Friend(friend_names): my_friends = friend_names def is_my_friend(name): return name

    in friend_names def buddy(method_name, *args): if method_name == 'is_friend_of': return is_my_friend(*args) return responder buddy = Friend(['alan', 'alonzo']) buddy('is_friend_of','guy') => False
  12. @AnjanaVakil def Friend(friend_names): my_friends = friend_names def is_my_friend(name): return name

    in friend_names def responder(method_name, *args): if method_name == 'is_friend_of': return is_my_friend(*args) return responder buddy = Friend(['alan', 'alonzo']) buddy('is_friend_of','guy') => False
  13. @AnjanaVakil Smalltalk class True ifTrue: a ifFalse: b ^ a

    value class False ifTrue: a ifFalse: b ^ b value
  14. @AnjanaVakil Smalltalk class True ifTrue: a ifFalse: b ^ a

    value class False ifTrue: a ifFalse: b ^ b value Lambda calculus TRUE := λx.λy.x FALSE := λx.λy.y
  15. @AnjanaVakil Alan Kay: - The early history of Smalltalk worrydream.com/EarlyHistoryOfSmalltalk

    - Comment on Moti Ben-Ari's Objects never? Well, hardly ever! computinged.wordpress.com/2010/09/11/moti-asks-objects-never-well-hardly-ever/#div-comment-3766 - E-mail to Stefan Ram on definition of OOP purl.org/stefan_ram/pub/doc_kay_oop_en - E-mail to Squeak list on "messaging" wiki.c2.com/?AlanKayOnMessaging William Cook: - A Proposal for Simplified, Modern Definitions of "Object" and "Object Oriented" wcook.blogspot.com/2012/07/proposal-for-simplified-modern.html - On Understanding Data Abstraction, Revisited cs.utexas.edu/%7Ewcook/Drafts/2009/essay.pdf Anjana Vakil, "Programming across Paradigms" youtu.be/uNPdZm5oF_E Andre Stalz, "Why we need callbags" staltz.com/why-we-need-callbags Structure & Interpretation of Computer Programs mitpress.mit.edu/sicp Learn You Some Erlang for Great Good learnyousomeerlang.com further reading & references
  16. David Albert, Darius Bacon, Lindsey Kuper, Julia Evans, Matthew Parker,

    Ezekiel Smithburg, Juan Hernández, Andy Lee, Michael Arntzenius & the Recurse Center Team Øredev thank you! @AnjanaVakil