+ 5
Object Oriented vs Functional Programming
I am an OOP guy from day one. Recently their has been some fuss about functional programming using scala for Java and ruby. apart from the fact the code it self will be shorter. Is there any other relevant reason I should make the switch to Functional programming??
4 Antworten
+ 11
My background is mathematics. Although I don't know much about functional programming I think FP would be more natural approach to many programming problems arising in math. That's why I am looking for some advise about how to learn functional programming in Java. See the following:
https://www.sololearn.com/Discuss/889031/?ref=app
+ 6
The $1000 question!
A few years ago Herb Sutter, one of the foremost C++ experts in the world, wrote "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software" (http://www.gotw.ca/publications/concurrency-ddj.htm).
Since concurrency is one of the main advantages that FP (such as Scala/Haskell/Scheme/Erlang/etc) languages have over OOP based imperative languages (such as C++/C#/Java/Swift/etc) - the reason being that in FP languages functions are free from side-effects and so are perfect for multi-threading - this is seen by some as an advantage that will eventually make FP dominant.
Even a C++ expert such as Bartosz Milewski blogged about the "The Downfall of Imperative Programming" and switched to Haskell.
But all is not perfect in FP land either - they too have their weaknesses! One of the foremost FP experts and FP consultant, Jon Harrop, blogged about "Disadvantages of purely functional programming" (http://flyingfrogblog.blogspot.fr/2016/05/disadvantages-of-purely-functional.html) - including that some algorithms/data structures are simply not FP friendly plus excessive allocations, etc.
So which is it? Are FP the future or is imperative programming still good for the long haul? The truth of course is that all programming languages have advantages/disadvantages.
But in my view there is another factor: OOP has one massive advantage over FP in that humans can much more easily mentally "map" what their program is suppose to do to the OOP model. It is not so easy with FP.
FP is definitely harder (and more abstract) than OOP. And IO just doesn't gel nicely with FP - and monads as a solution to this problem causes nearly as big a "mental" problem as the one it solves.
But, as they say, the proof "is in the pudding":
Even though the Tiobe index (http://www.tiobe.com/tiobe-index/) isn't perfect, it is still valuable to see the language popularity trends. And imperative languages still completely dominates the top 10.
Don't just yet throw those OOP books away!
+ 1
Functional programming is somewhat more difficult to master. Haskell, Scala are known to be hard. You don't have to switch unless you really need to.
0
Right you are, Ettienne. Rust is growing very strong as of today.