r/functionalprogramming • u/mto96 • Feb 11 '20
Java What Java has learned from functional languages
https://youtu.be/e6n-Ci8V2CM?list=PLEx5khR4g7PLHBVGOjNbevChU9DOL3Axj
22
Upvotes
r/functionalprogramming • u/mto96 • Feb 11 '20
6
u/mto96 Feb 11 '20
This is a talk from GOTO Copenhagen 2019, by Maurice Naftalin, Java Champion & Author and José Paumard, Java Champion, JavaOne Rockstar, Architect, Coach & Trainer. You can find the full talk abstract pasted below:
Functional programmers have been saying for decades that they know the way to the future. Clearly they've been wrong, since imperative languages are still far more popular. Clearly they've also been right, as the advantages of functional programming have become increasingly obvious.
Is it possible to combine the two models?
Scala is one language that does this and Java too has been on a journey, which still continues, of learning from functional languages and carefully adding features from them.
In this talk, we'll review what Java has learned from functional languages, what it can still learn, and how its added features compare to Scala's original ones.
12
u/squishyhobo Feb 11 '20
TL;DR
Use other better languages that have implemented this before.
Or I guess use java if you need to for your job and they are sorta catching up.
6
u/blamedrop Feb 12 '20
My two cents as I got triggered with their incompetent and sloppy example of pattern matching in Scala xD
String color, lack of=incapacitydefinition, use of non-existent?:operator...returnkeyword.equalsonString"red"value right away etc.They seemed competent in the beginning, duh. With basic knowledge of current Scala one could came up with following snippet:
Cheers!
2
u/The_One_X Feb 11 '20
As I have been saying for a while now, the future isn't OOP or FP, it will be a combination of the two.
1
u/taindissa_work Feb 11 '20
IMO OP's title is much better at conveying the intent of this talk, than the presenter's title. It seems like it's better for developers to learn from multiple programming paradigms rather than feeling like they need to 'imitate', or that the differences in paradigms are binary.
1
u/procsyma Feb 12 '20
Does anyone actually use new features of Java 8+ ? I saw so many examples of Java 8 code bases where people couldn't even use
Optionalproperly, let alone other functional features. Some would call.getin a try catch block, some would check if its defined before using it every single time if its not throw exception. I even saw in a horrible codebase where they mixed Scala Options and Java Optionals.1
u/yawaramin Feb 23 '20
This kinda reminds me of this tweet, haha: https://twitter.com/symbo1ics/status/1226994470689918976?s=21
-2
u/linguistics_nerd Feb 11 '20
The idea that imperative/OOP is valid because it is used more in industry is pure neoliberal ideology. It's not an argument. Never has been. FP has always been right. Listen to the nerds, it's a good rule of thumb.