News for hackers. Stuff that matters.
Re:An Object-Oriented Language for the '20s by howinteresting on Saturday March 13, 2021 @09:23AM (#26446733)
One of the fundamental issues with OO subtyping continues to be how variance works. I wish the author spent more time talking about how they envision variance.

My other big problem with OO is the spaghetti code that results once you start mixing overloads and hooks across superclasses and subclasses. The OO model really seems to be a little too low-fidelity overall.

Re:An Object-Oriented Language for the '20s by Hermel on Saturday March 13, 2021 @09:35AM (#26446803)
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.
Re:An Object-Oriented Language for the '20s by throw0101a on Saturday March 13, 2021 @09:49AM (#26446906)
> 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_ka...

* https://medium.com/javascript-scene/the-forgotten-history-of...

* https://softwareengineering.stackexchange.com/questions/4659...

Though it's recognized that Simula invented objects:

* https://www.hillelwayne.com/post/alan-kay/

Re:An Object-Oriented Language for the '20s by agumonkey on Saturday March 13, 2021 @10:04AM (#26447000)
One 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.
Re:An Object-Oriented Language for the '20s by agumonkey on Saturday March 13, 2021 @09:54AM (#26446936)
Is 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.

Re:An Object-Oriented Language for the '20s by wvenable on Saturday March 13, 2021 @01:07PM (#26448497)
Inheritance 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.

Re:An Object-Oriented Language for the '20s by branko_d on Saturday March 13, 2021 @10:24AM (#26447153)
I 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

Re:An Object-Oriented Language for the '20s by howinteresting on Saturday March 13, 2021 @12:00PM (#26447858)
Ehhh, 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.

Re:An Object-Oriented Language for the '20s by SomeHacker44 on Saturday March 13, 2021 @09:39AM (#26446827)
Which 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.
Re:An Object-Oriented Language for the '20s by blowski on Saturday March 13, 2021 @09:59AM (#26446970)
Over 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.

Re:An Object-Oriented Language for the '20s by mikewarot on Saturday March 13, 2021 @10:34AM (#26447222)
>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.

Re:An Object-Oriented Language for the '20s by invisiblerobot on Saturday March 13, 2021 @09:48AM (#26446901)
Exactly. Polymorphism is the killer feature and it's expressed more simply in functional languages like Clojure.
Re:An Object-Oriented Language for the '20s by ar-nelson on Saturday March 13, 2021 @09:29AM (#26446767)
I didn't really think about variance while writing the examples; I assumed it would just work the way it does in Scala and Kotlin (explicit variance annotations). I do wonder if that's necessary, though--in theory, the compiler could infer variance from how you use the type parameters, which is in a similar spirit to the rest of the language.

What do you think are the major problems with variance in OO?

Re:An Object-Oriented Language for the '20s by howinteresting on Saturday March 13, 2021 @11:58AM (#26447846)
Explicit variance, especially for types, is just really confusing. Implicit variance has the risk of breaking APIs or overpromising a particular variance without developers realizing.

If you have subtyping you need to think about variance. That's led me to believe that subtyping's simplicity is deceptive, and that it should be avoided as much as possible. (Rust has subtyping but only for lifetimes, and it's confusing enough there.)