4 ms·
Contrary to popular belief, OO is not primarily about inheritance. That’s one of its distinct features. But experienced software engineers tend to prefer compos
by Hermel 6y ago
Contrary to popular belief, OO is not primarily about inheritance. That’s one of its distinct features. But experienced software engineers tend to prefer composition over inheritance. OO is about encapsulation and about putting conventionally functions close to the data it operates on.
- SomeHacker44 6y agoWhich begs the question: why use OO at all if you prefer composition? I personally am "over" OO, even though I have been doing OO professionally for decades.
- invisiblerobot 6y agoExactly. Polymorphism is the killer feature and it's expressed more simply in functional languages like Clojure.
- blowski 6y agoOver the last 30 years, object oriented languages got more attention, more funding, more companies using them, more jobs available, more developers, more education resources, more libraries. In short, I use OO because everyone else does. Now in my 40s, I’m not going to change merely because another language is more expressive. But yeah, if I could do it all over again, I’d probably choose Clojure.
- mikewarot 6y ago>why use OO at all if you prefer composition? OO is a way to bundle a structure with the methods to manage it. Inheritance is a way to manage the need to customize an object. Composition is a way to bundle objects. Why wouldn't you do both? That's what Delphi did back in the 1990s when they built the Visual Component Library. (VCL) You build your forms in the GUI builder, which composed a form object out of various components which were all eventually derived from tObject. It still lives on, and Lazarus implements something similar for Free Pascal.
- throw0101a 6y ago> OO is about encapsulation and about putting conventionally functions close to the data it operates on. According to Alan Kay, the essential ingredients of OOP are: Message passing, Encapsulation, Dynamic binding. > OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I’m not aware of them. * https://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en https://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_ka... * https://medium.com/javascript-scene/the-forgotten-history-of-oop-88d71b9b2d9f https://medium.com/javascript-scene/the-forgotten-history-of... * https://softwareengineering.stackexchange.com/questions/46592/so-what-did-alan-kay-really-mean-by-the-term-object-oriented https://softwareengineering.stackexchange.com/questions/4659... Though it's recognized that Simula invented objects: * https://www.hillelwayne.com/post/alan-kay/ https://www.hillelwayne.com/post/alan-kay/
- agumonkey 6y agoOne think you may get (but I may speculate here) from his talk is that he had a way more abstract / mathematical view of systems and programming. I think he didn't see OO as isolating tasteful procedure more than providing interfaces and concepts to compose concept cleanly.
- agumonkey 6y agoIs it funny or sad that after 30+ years, the industry is not clear on what is or is not OO. At a gig in my college cs lab, teachers talked about OO, 3 teachers, no answer the same.
- branko_d 6y agoI think this quote from Alan Kay is rather illuminating: "The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be." https://wiki.c2.com/?AlanKayOnMessaging https://wiki.c2.com/?AlanKayOnMessaging
- howinteresting 6y agoEhhh, inheritance hiearchies are the well-worn grooves of OO, the paradigm encourages them even if it doesn't strictly require them. I don't buy this argument. Typeclasses are a much better way to do polymorphism.
- wvenable 6y agoInheritance is very useful in OO but it's all well-tread ground now. The things that have is-a relationships are all well defined and part of libraries and frameworks that have been around for decades. As a high-level app developer, one has much less use for is-a relationships but what we do sits on top of that well-tread inheritance filled OOP environment.