9 ms·
Functional Programming? Don’t Even Bother, It’s a Silly Toy
- juliangoldsmith 7y agoTell that to Paul Graham.
- bovermyer 7y agoThis feels very much like the author tried to use functional programming to solve a particular problem, got bit by it, and is now raging that the tool is broken. I'm not in favor of functional programming everywhere, but it's a valid tool in the toolbox.
- bjoli 7y agoIt is clearly irony.
- happytoexplain 7y agoEither it's not clear, or you're implying that multiple commenters here are in some way incompetent.
- girvo 7y agoOr, more likely, it just surfaced that a lot of us skim articles. It is clear, but really only about halfway through the article itself (which isn’t a very good statement on the article getting its message across, to be honest)
- LyndsySimon 7y agoIt's clear, but it's not immediately clear. You have to read a substantial amount of the article before it becomes clear, because the author starts with very little indication of it satirical. I found myself starting from the premise that it was in earnest and only realized it was satirical about 1/3 of the way through. Until that point I had a mental checklist of things I disagreed with, beginning with the phrase "expected amount of embedded abstractions". Come to think of it, it's really an excellent example of effective satire, and these comments are an illustration of Poe's Law.
- dwaltrip 7y agoThere's an ocean in between those extremes...
- mcphage 7y ago> Either it's not clear, or you're implying that multiple commenters here are in some way incompetent. Reading comprehension—especially deciding if something is satire or not—is a common problem on HN. I wouldn't classify that as incompetence, but it is an issue.
- bjoli 7y agoThe article even claims, highlighted in the article, "It is obvious that so-called “functional” programming is flawed, it makes redundant things like refactoring and unit testing unnecessarily easy". If you are not capable of judging it as blatant sarcasm, I would in fact call you incompetent. I doubt that is the problem. I think most people didn't read long enough for the sarcasm to be obvious and then wrote their comments as if they had read it all, despite probably not making it longer than the first paragraph. That might not be incompetent, but it is at least intellectually dishonest.
- _hao 7y agoThis post is satire.
- bovermyer 7y agoI didn't make it far enough through the article to come to that conclusion. Perhaps the Internet's proclivity for nonsense and half-cocked opinions masquerading as long-form intellectual discussion has hardened me.
- icedchai 7y agoI assumed the article was satire. The OOP solution is overly complex garbage compared to the simplicity of the functional solution.
- pron 7y ago> functional programming ... is based on mathematics Can we stop with this nonsense? I don't even know what "based on mathematics" means. All programming languages are formal languages, and all formal languages are inspired by mathematics in their design, and we can use mathematical reasoning to reason about them (although the form of mathematical reasoning can differ; pure FP strives to use equational reasoning, while imperative code uses assertional reasoning). While it is true that functional programs bear more resemblance to mathematical notation than imperative programs, but the majority of elementary mathematics cannot be directly expressed in FP in a similar notation -- or in any programming language with some computational complexity features (in the computational, "executable" part of the language; it can be expressed in the specification part, like a type system or a contract system). E.g. x + 4 = 5 cannot be directly expressed in the computational part of the language, let alone f(x) = 5. Nothing that's nondeterministic can be expressed, either, such as x < 10, or x > y. Some of those can be expressed in logic programming (so it's even more "based on mathematics" than FP!), but at a cost in computational complexity. But while glibly dismissing silly strawman arguments (which, I assume, some do make), the author contributes some silly claims of his own. For example: > This has [the] consequence of reducing complexity, and thus reducing the number of bugs. So, seeing as the author is so interested in precision and mathematics, I'd like to enquire where he pulled this fact from. But let me put this more generally: if pure functional programming has such obvious huge advantages over OOP with a big, real, impact and all, then a curious person with a scientific mind would ask what is the average difference in cost/quality that a company should expect when switching to pure FP? This should be a very easy question, because clear, obvious, large effects are easy to find (in fact, they're hard to hide) even over small samples. If a prediction of an easily observable effect does not turn out an easily observable effect, could there be something wrong with the hypothesis? And if the hypothesis makes a prediction of an effect that is hard to observe in practice, is it really so clear and obvious?
- mrkeen 7y agoBut that's precisely the point of functions (not methods, not procedures).
- AnimalMuppet 7y ago
- phkahler 7y agoSeems more anti-OOP than pro-functional.
- MattBearman 7y agoI'm thinking this could do with a [satire] tag :)
- human20190310 7y agoIf I hadn't skipped the middle part and read the ending, I might never have known. I think the author is losing a lot of readers before the satire becomes apparent.
- mrkeen 7y agoThis is at least the third sarcastic take on FP vs OO that I've seen, and possibly the worst. It's hard enough to communicate the differences without crap like this in the mix. edit: The two posts before did not pick up on the sarcasm.
- human20190310 7y agoThe irony is that the author's satire of object-oriented verbosity is itself so verbose that the point gets lost in all the words.
- lixtra 7y ago> So-called “functional” programming has no proper mechanism of abstraction since it is based on mathematics (which obviously is inferior and has no applications in the real world apart from academia). It’s tough to read on after that. Edit: Okay, I missed the irony that becomes clear later on.
- splodge 7y agoWouldn't a enterprise developer store pricing information in a database, rather than hardcoding it, whether it is hardcoded into functional or OO software?
- Someone1234 7y agoI don't find the satirical framing particularly constructive. I feel like a lot of people are going to miss the point, and the article wastes a lot of words just keeping up the pretense. I do wonder though, why functional programming hasn't taken off in a bigger way? Languages like F# are certainly very good, but their usage remains fairly small, what do they lack that would allow them to take off? Or is it a problem with too few programmers being trained in functional and not being comfortable with it?
- mrkeen 7y agoIt's like the "what have the Romans ever done for us" Monty Python skit. Unless I'm mistaken, garbage collection, types, typeclasses, polymorphism, option-types, lambdas, REPLs etc. all debuted in functional languages.
- stcredzero 7y agoIt could be argued that garbage collection, polymorphism, lambdas, and REPLs were semi-mainstreamed by Smalltalk. That's not to say that it was the first appearance of those features. However, it was a big incursion into mainstream awareness. In 2019, all of those things are squarely mainstream. In the 1990's, lots of programmers regarded them akin to "woo."
- mcguire 7y agoWas Smalltalk ever mainstream? It was explored briefly in the early '90s at IBM (Hi, OS/2 Workplace Shell!), but the general consensus before the project was cancelled was to go with C/C++. I suppose education also saw some use, but various Lisps have most, if not all, of the above features and much more mainstream use in the '80s.
- stcredzero 7y agoWas Smalltalk ever mainstream? I'd say mainstream adjacent, like Lisp. There was once 80% penetration into the Fortune 500. various Lisps have most, if not all, of the above features and much more mainstream use in the '80s. One could argue that Smalltalk was designed in part to be a "Lisp for children." So of course, Lisps already had those features.
- carti 7y ago> I have personally taught a few junior developers functional programming in JavaScript, and they became really good at it in about half a year. If only...
- stcredzero 7y agoThe article is satire, but I have some observations of and questions about FP. It seems like every FP programming environment develops objects of some kind. React/JSX has classes. Clojure has a few ways to use Java classes. Monads seem to be wrappers at some level. Then, you have environments which are explicitly "hybrids" between OO and FP, like Scala and MOP in Common Lisp. The whole world seems to be converging on the usefulness of immutability, and this process started decades back. Also going decades back, at least as far as the 90's, Smalltalk folks recognized that a lot of the goodness in the class library and environment came from the majority of class library functions being pure, or the encapsulation allowing programmers think about them as if they were pure. Would it be going too far to observe that programming is generally converging on pragmatic, mixed environments where the value of immutability and referential transparency is emphasized, but where encapsulation of state is also used? This is not absolutely true 100% across the board, but it seems to be one of the larger scale trends.
- mrkeen 7y agoI have used Scala quite a bit, and I do feel it does a few things better than Java. That said, I really dislike the 'best-of-both-worlds' argument for mixing OO and FP. Immutability is fantastic. If you are sitting in OO land, and someone gives you a library for immutable collections - great! But if you're already practicing immutability, and someone starts modifying your stuff, what is to be gained? It's the same story with null. I finally got rid of that - why would I want to become 'pragmatic' and get null back?
- stcredzero 7y agoThat said, I really dislike the 'best-of-both-worlds' argument for mixing OO and FP. I'm not making that argument. I'm making the observation that over time, upon collision with the enterprise or real world, all Functional Programming environments seem to develop OO features, and most Object Oriented environments either have or embrace FP features. It's the same story with null. I finally got rid of that - why would I want to become 'pragmatic' and get null back? I think it's possible to get rid of null. However, I don't think it's possible to get rid of Objects in FP. They always seem to return in some form, disguised by nifty and abstruse terminology and mechanisms. It's not some rosy "best of both worlds" situation. It's more or a realist, well, I guess we're stuck with things from here and there. Despite the "almost a field" having its disfunctions, three decades of programming language history and the efforts of countless geniuses likely means something, and this pattern of OO environments gaining FP features, and FP environments gaining (perhaps disguised) Objects persists across that.
- deleted 7y ago[deleted]
- blikdak 7y agoLols, thought it was serious at first, because enterprise.
- smitty1e 7y agoThis was Inversion Of Control applied to an essay.