3 ms·
One important consideration I think that's missing here is how the computation over the data is processed. Immutability, a hallmark of FP, has a small performan
by jameslk 8y ago
One important consideration I think that's missing here is how the computation over the data is processed. Immutability, a hallmark of FP, has a small performance hit on both computation and memory[0] but allows for computation to be divided more easily via referential transparency[1].
For applications that will scale horizontally, such as web apps, I think FP makes more sense, since computation over data can spread across multiple servers/processors. Where as for applications that cannot scale horizontally but must be performant, such as game engines, OOP seems to make sense since it makes mutation easier to handle by hiding it with encapsulation.
I have a hypothesis that multiple core processors and cloud computing led to the current surge in popularity of FP.
0. https://en.wikipedia.org/wiki/Functional_programming#Efficiency_issues https://en.wikipedia.org/wiki/Functional_programming#Efficie...
1. http://wiki.c2.com/?ReferentialTransparency http://wiki.c2.com/?ReferentialTransparency
- gnulinux 8y agoImho this kind of thinking is wrong. I believe in every large enough program such as a web server or game engine there will be parts that are suitable for fp and suitable for oop. A web server (of a large enough company) and a game engine are complex enough programs that they do not include one type of data flow, so why would we need to use only one type of programming to formalize that data flow?
- jameslk 8y agoApplications large enough will likely contain both paradigms, yes, but the processing constraints of the application will likely dictate the appropriate methodology to use dominantly. For example, I always found it ironic that the JavaScript library Immutable.js uses OOP heavily, but I'm guessing this was for performance reasons.
- sshine 8y agoYes, every compiler/transpiler inevitably must address its underlying (virtual) machine's primitives.
- tonyg 8y ago> Immutability [...] allows for computation to be divided more easily via referential transparency. Do you mean it allows computation to be parallelized more easily? Compared to what? How does "referential transparency" affect the situation one way or the other?
- smnplk 8y agoThis is a great point.