3 ms·
> the mistake that many FP advocates make is to make it a war of FP vs anything else. I don't disagree with this (goodness knows there are plenty of functional
by DonaldPShimoda 6y ago
> the mistake that many FP advocates make is to make it a war of FP vs anything else.
I don't disagree with this (goodness knows there are plenty of functional purists who come across as religious zealots), but I think it's also worth mentioning that there's an opposing camp of people who are hard-set against ever considering FP for anything at all because they've bought fully into object orientation and stateful computation.
Both solutions are well-suited to certain kinds of problems, and this opposition is well summarized by study of what is called the Expression Problem[0]. A good developer should know both paradigms (in addition to others!) and use each where it is best suited.
[0] There are other issues than those discussed by the EP, but the EP is, I think, the most simple perspective of the distinction between OOP and FP.
Edit: TIL you cannot escape an asterisk on HN. That's a bummer.
- dashwav 6y agoIn my experience, I have seen much less of the OOP-only group, especially in recent years. The general feel I have seen when communicating with other developers about this is that OOP is a tool and it's probably not the best one, but they are comfortable with it and it's problems. In general it feels like the overall feeling to FP is either "I don't have time to learn a new paradigm when my current one is working good enough to make the company money" or "I love using FP ideas in my code when it makes sense" I really feel like this is the ideal state for Software Development, as either side "winning" will only hurt the robustness of the environment.
- DonaldPShimoda 6y agoOh, sure! I didn't mean to suggest that there were as many as the only-pure-FP crowd, though I can see how my phrasing may have suggested as much. I just meant to bring up that there are people like that, who refuse to (consciously) adopt any amount of FP in their development. I have interacted with some myself. Most of them make arguments about, like, "People think in terms of state so FP is inherently a bad user experience" or something to that effect.
- AmpsterMan 6y agoI've had people chew me out for using function objects in Java, saying it's too complicated and the newest thing isn't always great. I wanted to point out that Java 8 is 6 years old now, and qsort() has been a thing for a while.
- dkarl 6y agoI remember when I discovered "map" and "filter" in Python around 2000 or so and everybody I showed them to at work (it was a Java shop) thought they were so difficult and abstract compared to ArrayList result = new ArrayList(); for (int i = 0; i < input.size(); ++i) { etc. To them that was the "easy" way, and I was a weird kid into weird shit. I didn't make any progress with them at all trying to convince them that "map" and "filter" were simpler than iterating over an index every single time. Now everybody has forgotten that business logic used to be one for-over-index loop after another, often nested, and debugging an error often meant running through a for-loop in a debugger over and over again examining the partially constructed result at the end of each iteration trying to figure out where it went wrong. FP saved us from that, and it gets no credit. People only think of FP as the scary stuff they haven't learned yet.