News for hackers. Stuff that matters.
Re:The Repeated Deaths of OOP (2015) by Hermel on Sunday June 06, 2021 @08:03AM (#27412573)
The essence of OOP is not inheritance, that’s a nice to have. The essence of OOP is to encapsulate the data and the functions that operate on that data into an object and hide the internal state of the object from the rest of the program.
Re:The Repeated Deaths of OOP (2015) by throwaway894345 on Sunday June 06, 2021 @08:36AM (#27412724)
Every OO proponent seems to have their own definition of OO. Another I’ve heard is “message passing”, although that one even has many different flavors since it isn’t well defined and some argue that methods constitute message passing and others envision something closer to an Actor model.

This is all well and good as long as people are clear about what their definition is (although it is weird how many proponents have wildly different definitions and yet still seem to feel some kind of kinship). The maddening folks are those who deflect all criticism of OOP by saying “that’s not true OOP without ever asserting any particular definitional qualities. These people seem to have an undying love for the sequence of letters O-O-P. So we have these weird conversations where I say, “fine, I contend that anything that might make OOP unique from other paradigms (e.g., inheritance) is a misfeature”.

Re:The Repeated Deaths of OOP (2015) by bookofsand on Sunday June 06, 2021 @09:35AM (#27413043)
For yet another definition, OO is about encapsulated polymorphic interfaces. Which raises a communication difficulty: encapsulated polymorphic interfaces are very useful in some of the cases (ADTs, modules), and a misfeature for the other cases (data modeling). I have yet to see a conversation, especially an internet conversation, where participants reach a rough consensus on the contextualized upsides / downsides of a given concept. It's either 100% heaven or 100% hell.
Re:The Repeated Deaths of OOP (2015) by ncmncm on Monday June 07, 2021 @12:29PM (#27424468)
Use it where it's useful, use something else otherwise.

It doesn't need much discussion.

If your language forces you to use mechanisms and organization inappropriate to the problem, the solution will be ugly and awkward. In that case a better language, or more usually a better job, is in order. The requirements might dictate the language, but they don't typically dictate you being the one to do it.

Re:The Repeated Deaths of OOP (2015) by jasperry on Sunday June 06, 2021 @11:12AM (#27413728)
Do you have any references with detailed analysis of this issue? How much one should emphasize concrete data types vs. interfaces seems like a key consideration in language design.
Re:The Repeated Deaths of OOP (2015) by cout on Sunday June 06, 2021 @08:49AM (#27412798)
The concept of a message is older than the actor model, so I don't think it can be considered a fundamental part of the definition of a message (so Smalltalk-style messages are still messages). I do think the Actor model is the most ideal form of message-passing in a single-process system, and seems to be the direction many languages are heading toward as they evolve.
Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @09:00AM (#27412854)
> The concept of a message is older than the actor model

Publications by Hewitt or Sussman in the seventies even suggest that the concept traces back to lambda calculus.

> so Smalltalk-style messages are still messages

Only Smalltalk-72 had true "message passing" (i.e. arbitrary tokens sent to an object for interpretation); Smalltalk-76 onwards uses a virtual methods implementation similar to the one of Simula 67 or C++ instead.

Re:The Repeated Deaths of OOP (2015) by ProfHewitt on Sunday June 06, 2021 @05:08PM (#27416345)
The tokens in Smalltalk-72 were not "messages" to Actors where whole messages are Actors.

Since Actors are universal primitives of digital computation,

it is possible to reframe all previous work as using

messages, including Turing Machines and the lambda calculus.

Lambda calculus was originally defined using string substitution.

Both lambda calculus and Turing machines are computationally less powerful than Actors.

Re:The Repeated Deaths of OOP (2015) by aliasEli on Wednesday June 09, 2021 @11:42AM (#27449232)
> Both lambda calculus and Turing machines are computationally less powerful than Actors.

Do you have a reference for that?

Re:The Repeated Deaths of OOP (2015) by ProfHewitt on Saturday June 19, 2021 @09:43PM (#27566295)
Re:The Repeated Deaths of OOP (2015) by throwaway894345 on Sunday June 06, 2021 @08:54AM (#27412831)
To be clear, I’m saying “something like the actor model”, not the actor model specifically, though I assume the actor model also satisfies even the narrower definitions of message passing.
Re:The Repeated Deaths of OOP (2015) by augustk on Sunday June 06, 2021 @05:08PM (#27416339)
What you describe is the essence of an abstract data type (ATD). An ADT can be easily implemented in a non-object oriented language like C. To my understanding the essence of object oriented programming is inheritance and polymorphism.
Re:The Repeated Deaths of OOP (2015) by mariodiana on Sunday June 06, 2021 @01:29PM (#27414680)
"OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late binding of all things." – Alan Kay
Re:The Repeated Deaths of OOP (2015) by ratww on Sunday June 06, 2021 @02:40PM (#27415224)
That's a great definition, but it mostly applies only to Smalltalk itself and a subset of Smalltalk descendants, like Ruby.

EDIT: changed ancestor to descendant, thanks gnufx!

Re:The Repeated Deaths of OOP (2015) by gnufx on Sunday June 06, 2021 @03:11PM (#27415472)
[s/ancestor/descendent/]

Not Erlang (maybe depending on whether you consider something like Armstrong's universal server extreme late binding)?

Re:The Repeated Deaths of OOP (2015) by ratww on Sunday June 06, 2021 @03:15PM (#27415489)
Good question! Alan Kay himself definitely thinks so:

https://www.quora.com/What-does-Alan-Kay-think-about-Joe-Arm...

Re:The Repeated Deaths of OOP (2015) by mypalmike on Sunday June 06, 2021 @05:19PM (#27416437)
I'd say most of these attributes map pretty well to modern OO practices in popular languages, particularly Java, where late binding comes from widely used inversion of control frameworks like Spring. And the underlying mechanism for these is dynamic method dispatch, which I'd agree with Robert Martin is the single unifying requirement of OO.
Re:The Repeated Deaths of OOP (2015) by chriswarbo on Sunday June 06, 2021 @08:22AM (#27412657)
If this is the essence of OOP, would you consider modules/existential-types in StandardML to be OOP? As a followup, what about OCaml (is that "more OOP"?)
Re:The Repeated Deaths of OOP (2015) by jcelerier on Sunday June 06, 2021 @10:02AM (#27413222)
ML modules are definitely OO
Re:The Repeated Deaths of OOP (2015) by c-cube on Sunday June 06, 2021 @04:37PM (#27416093)
See, that's just ridiculous and shows how undefined and vague "OO" is. The only relevant feature there is encapsulation, that most languages provide in some way. How is that OO?

I vote for just not using this term anymore and talk about class based langusges or prototype languages or whatever.

Re:The Repeated Deaths of OOP (2015) by jcelerier on Monday June 07, 2021 @03:08AM (#27419869)
> The only relevant feature there is encapsulation, that most languages provide in some way. How is that OO?

PL researches seem to have no trouble finding equivalences between ML modules and OO :

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53...

My personal opinion which tries to be as general as possible to encompass most definitions is that OO just means that semantic entities can bind a set of named values with a set of named operations / functions / methods / whatever you call them.

    struct foo {
      int bar;
      void (*compute)(int x, int y); 
    };
is also OO.
Re:The Repeated Deaths of OOP (2015) by mypalmike on Sunday June 06, 2021 @05:28PM (#27416504)
The problem isn't that the term is poorly defined. It's that it's widely misused. Dynamic dispatch (basically "inheritance") is what most experts claim to be the defining feature necessary to claim OO.
Re:The Repeated Deaths of OOP (2015) by ncmncm on Sunday June 06, 2021 @08:11AM (#27412605)
OO less inheritance has a different name: object-based. It isn't better or worse. But the distinction is worth keeping.
Re:The Repeated Deaths of OOP (2015) by layer8 on Sunday June 06, 2021 @02:37PM (#27415202)
Languages without inheritance/subtyping are normally called object-based [1], in distinction from object-oriented.

[1] https://en.m.wikipedia.org/wiki/Object-based_language

Re:The Repeated Deaths of OOP (2015) by barrkel on Sunday June 06, 2021 @11:39AM (#27413868)
I would say that polymorphism open to extension is also important, and subtype / supertype hierarchy. It implies some kind of composition of interface types in a static language.
Re:The Repeated Deaths of OOP (2015) by andi999 on Sunday June 06, 2021 @11:55AM (#27413982)
While data encapsulation sounds like a nice feature in theory, it seems to be the actual biggest flaw.
Re:The Repeated Deaths of OOP (2015) by kaba0 on Sunday June 06, 2021 @01:40PM (#27414758)
How is it a flaw? There are data-first processes where a LISP-style data “objects” are better, but there are many stateful objects, eg. a database connection where you very much don’t want anyone to access a flag with this specific meaning or IP or secrets, etc.
Re:The Repeated Deaths of OOP (2015) by rualca on Sunday June 06, 2021 @09:34AM (#27413038)
> The essence of OOP is not inheritance, that’s a nice to have. The essence of OOP is to encapsulate the data and the functions that operate on that data into an object and hide the internal state of the object from the rest of the program.

What is inheritance but a way to encapsulate data and methods in a way where you only need to override a subset of very specific methods and/or data to specialize an implementation?

Re:The Repeated Deaths of OOP (2015) by ratww on Sunday June 06, 2021 @12:45PM (#27414347)
Inheritance is a bit more complicated than that.

Your definition is closer to what the Template Method pattern [1] is, rather than inheritance in general.

Keep in mind also that neither inheritance itself nor the Template Method pattern guarantee encapsulation.

[1] https://en.wikipedia.org/wiki/Template_method_pattern