News for hackers. Stuff that matters.
Re:Java 12 by ilovecaching on Tuesday March 19, 2019 @08:12PM (#19437547)
Please elaborate on how OO is fine. OO hides state, which makes reasoning about cache, and therefore performance very difficult, which is why most game programers take a data oriented approach. It hides state but gains none of the advantages of Erlang because all of the implementations forgot to make state only mutable through explicit message passing. Inheritance isn’t an abstraction because you inherit both code and state, which requires explicit knowledge of the intervals of the parent. It’s a code pasting tool. As OO tries to model arbitrary patterns in nature it’s also difficult to reason about the graph of objects apposed to the linear flow of data in FP. Pretty much all of the OO languages are walking back OO features at this point and trying to add type classes (contracts) or functional pieces, mapping and filtering a la linear data transformations.
Re:Java 12 by int_19h on Wednesday March 20, 2019 @12:04AM (#19438864)
> It hides state but gains none of the advantages of Erlang because all of the implementations forgot to make state only mutable through explicit message passing.

Smalltalk is exactly like that - other objects' state is only mutable through explicit message passing. It's also widely considered the penultimate pure OO language.

> Pretty much all of the OO languages are walking back OO features

About the only feature I can think of for which this is somewhat true is inheritance, and that's because we realized that aggregation is often a better model, and can be easily supported by the language to be no more verbose. But it doesn't fundamentally change OO - it was never about inheritance first and foremost; I mean, prototype-based OO doesn't even have that conceptually.

> and trying to add type classes (contracts)

In most OO languages, these typically naturally evolve out of interfaces.

> functional pieces, mapping and filtering a la linear data transformations.

This is not contradictory to OO in any way. Again, Smalltalk has had "select" (filter) and "collect" (map) from the get go.

Re:Java 12 by jholman on Thursday March 21, 2019 @04:18AM (#19450068)
Minor question: what does the word "penultimate" mean in your comment?
Re:Java 12 by spricket on Tuesday March 19, 2019 @08:44PM (#19437755)
I actually agree with you here that OO is overused. Java has added quite a bit of FP in recent years though.

Lombok makes immutable data classes trivial. Improved interface support for default methods make it possible to largely ignore OO if you don't want it.

FP is mostly a community effort at this point, but solid. Java Streams are decent for basic stuff like map/filter but RXJava is extremely powerful if you want the complexity it comes with. Vavr is nice for adding more FP types too

Re:Java 12 by blattimwind on Tuesday March 19, 2019 @08:37PM (#19437712)
These are actually all fairly common problems so I'm not sure why this is drowned out in gray...
Re:Java 12 by Cyph0n on Tuesday March 19, 2019 @08:49PM (#19437781)
The over-zealous tone may annoy some people. Also, he/she could have gotten the same point across more effectively without implying that Erlang and FP magically solve all problems.
Re:Java 12 by Scarbutt on Tuesday March 19, 2019 @08:45PM (#19437762)
True, class inheritance is so hard to get right that is just better to avoid it. Lots of coupling and spaghetti code because of this, but to be fair, you also see this on other languages, like python, php and even JS.