6 ms·
"FP" camps tend to come in two flavors: "I'm a mathematician writing a computer program, and all problems will be made to look like math problems even if it mea
by sidlls 3y ago
"FP" camps tend to come in two flavors: "I'm a mathematician writing a computer program, and all problems will be made to look like math problems even if it means the program becomes an inscrutable mess of types and dense syntax" and "functional-ish idioms are included". The latter is useful, sometimes, for cloud computing and parallel computation; the former tends to have too many problems (slow build, slow execution, poor jargon laden syntax, etc.) to be very useful outside of academia.
I am (perhaps obviously) biased, here, but I tend to just roll my eyes whenever any of my colleagues suggests we should use functional programming to solve a problem. There are actually very few real-world use cases where it's objectively better.
- wredue 3y agoIs “wanting evidence for constant silver bullet claims that never actually pan out” really “obviously biased”? It’s not just you. Functional Programming really does not adequately solve any of the problems that its advocates claim while refusing to provide any evidence. And it’s not “biased” to write these claims off.
- epgui 3y agoI don't know what "silver bullet" claims you've heard, but I'm not sure how that is relevant to this thread. I don't think I've made any outlandish claims, or any claims that aren't substantiated by a preponderance of academic literature.
- roenxi 3y agoI find this whole thread fascinating because nobody seems to have identified what functional programming is defined as (programmers can just use functions to code and end up with functional programming, it isn't an obscure style), who the advocates are or what they claim. And yet, without any substance, the debate rages.
- epgui 3y ago> nobody seems to have identified what functional programming is defined as Nobody asked (until now, so thank you for asking!), and this is a fairly well discussed topic for anyone who cares to search! You will probably get a lot of slightly different answers depending on who you ask or where you look, but I think a very strong common thread is "referential transparency". Functional programming gives you that, and that is the property that makes FP particularly well suited for parallel computation. Referential transparency is related to the concept of "function purity" (in the sense that either one usually guarantees the other), which you will often hear people talk about as well. The two concepts are so intimately tied that sometimes I wonder if they're two different perspectives on the same thing. This, along with the fact that FP has been an active area of research (an important part of innovation) for a long time, is why I brought it up. https://en.wikipedia.org/wiki/Functional_programming https://en.wikipedia.org/wiki/Functional_programming https://en.wikipedia.org/wiki/Pure_function https://en.wikipedia.org/wiki/Pure_function https://en.wikipedia.org/wiki/Referential_transparency https://en.wikipedia.org/wiki/Referential_transparency https://softwareengineering.stackexchange.com/questions/293851/what-is-it-about-functional-programming-that-makes-it-inherently-adapted-to-para https://softwareengineering.stackexchange.com/questions/2938... --- > programmers can just use functions to code and end up with functional programming, it isn't an obscure style That's not how it works. Note that functional programming has nothing to do with merely "writing functions". --- > without any substance, the debate rages The substance is there and there is plenty of it, but learning requires work.
- arzke 3y ago> Referential transparency is related to the concept of "function purity" (in the sense that either one usually guarantees the other), which you will often hear people talk about as well. Isn't referential transparency (the property of a function that allows it to be replaced by its equivalent output) a consequence of function purity? In other words: could a pure function not be referentially transparent? Also, I remember Robert C. Martin describing the functional programming paradigm as a "restriction upon assignment". I kind of like this definition as the rest seems to flow from it: if you can't assign, you can't mutate. If you can't mutate, you have pure functions, which are referentially transparent.
- wredue 3y agoFunctional programmers regularly claim: -Haskell is faster than C (lol) -FP gives you free concurrency -FP makes code more testable -FP is easier to read -FP is easier to consume for people -FP results in no bugs -FP is easier to change -FP will literally suck your peepee -Actually FP is the second coming for Christ It’s really funny how you also pretend you’ve never heard of all the silver bullet claims that are incessantly plaguing every programming forum. What’s also really funny is your multiple alt accounts manipulating your votes. You must be real secure in those those claims.
- epgui 3y agoI agree with some of these points, but none of them are claims I made in the context of this discussion, so I’m not sure why you’re even arguing about those. It’s irrelevant.
- wredue 3y agoThey’re false claims. And I didn’t bring up the false claims FP programmers make until you asked for it to happen. I simply said that rejecting the ridiculous silver bullet claims that FP programmers make is completely fine because they don’t provide any evidence and that which is asserted without evidence can be dismissed without it. Not that that matter because all of those claims are demonstrably false anyway!
- roenxi 3y ago> -FP will literally suck your peepee > -Actually FP is the second coming for Christ On a style point, you've rather undermined yourself that these are common claims because there are entries on this list that are clearly fabricated, as well as others that look like wilful misinterpretations of what someone else said. That casts doubt on the more reasonable entries. There are annoying FP evangelists out there, but the overall tone pattern matches straw-manning. You'd have made it easier for everyone taking the whole list seriously. Transparently mixing fact and fiction just makes it harder for people who aren't already part of a conversation.
- tome 3y ago
- kaba0 3y agoThen why has it been slowly incorporated into literally every mainstream PL? You do know you don't have to be an extremist, and your code can contain both FP, OOP and imperative parts, whichever makes the most sense? FP and OOP are not even opposites. They absolutely solve real issues, and it's just sticking your head into sand to say otherwise.
- epgui 3y ago> all problems will be made to look like math problems All problems that can be solved with code are math problems. Proofs and programs are isomorphic (see the Curry-Howard correspondence). --- Edit: this is a factually accurate comment, delivered dispassionately. It's not controversial or new-- it's something we've known for longer than the C language has existed. Why the downvote? Like I said, see this: https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspon...
- sidlls 3y agoThis is like saying all physical engineering problems are quantum mechanics (or insert other physics theory) problems. It’s technically correct (the best kind of correct), but misleading and useless as a matter of practice.
- epgui 3y agoI see what you’re trying to do with the comparison, but it’s not really the same. In your example, the two things are separated by at a minimum one layer of emergence: your example is more like saying biology is just chemistry. In maths and programming, they are both at the same level, no emergence. I also haven’t found what you say to be true at all— As I’ve been learning more maths and more programming, and learning more about the link between the two, I have found that the ability to see problems from more than one angle has had a dramatic impact on how clearly I think and how efficiently I solve problems. Not useless whatsoever.
- sidlls 3y agoI was an academic physicist for the first several years of my post-graduate school career--I, too, see much value in having multiple perspectives to a problem. But that's quite different from your other claim. Maths and programming are not at the same level. When one writes a "hello world" program, math does not figure into the final text of the code at all. Similarly, when one writes code to implement a system interacting with multiple dependencies, one is not doing mathematics, except in the trivial sense of your original comment. That is to say, at such a remote distance that it's meaningless to describe the activity as a mathematical one.
- slotrans 3y agoInteresting. Functional programming is the only strategy I've seen be successful at building business software. (Hint: you can do FP in Java and it's not even awkward, and SQL is inherently functional).
- sidlls 3y agoI work at a FAANG-like company. The code base has almost no functional programming paradigms deployed. It’s a multi-billion dollar company from which I, an IC cog in the machine employee, became a multimillionaire through from the IPO. It’s wildly successful.
- ralphc 3y agoIs it all design-patterny OOP?
- sidlls 3y agoThe vast majority of it is, unfortunately. That's starting to change, though, as we are hitting some pretty severe maintenance and performance issues, as well as being bottlenecks to making changes, that all the abstraction is obviously the root cause of. None of the services the team I used to lead utilized OOP (in the sense you're referring to), and the new team I lead will be making sweeping changes to move away from it under my guidance. It served its purpose, but we've outgrown it.
- deleted 3y ago[deleted]