8 ms·
I'm confused as to why he doesn't put functional programming as a yes. He writes "Functional languages are still quite niche, but functional programming ideas a
by raiflip 9y ago
I'm confused as to why he doesn't put functional programming as a yes. He writes "Functional languages are still quite niche, but functional programming ideas are now mainstream, at least for the HN/reddit/twitter crowd."
While purely Functional languages are definitely not mainstream, as he puts functional programming ideas are pretty mainstream. At the same time major OO languages like java have incorporated functional programming ideas, so arguably even Java is not purely Object Oriented anymore. It seems to me by his criteria that would also put OO as a no too.
If he comes from OO languages I think this is a bias because it is easy to take OO for granted and put strict requirements on foreign Functional Programming before accepting it as successful. However it seems to me the only criteria that should be needed to call either paradigm successful is if their ideas are are mainstream, which is true for both languages.
Basically if Function Programming ideas have gained currency then it should be regarded as successful.
- bryanlarsen 9y agoYou can't get much more mainstream than Javascript, and it's fairly functional.
- zaarn 9y agoJS is multi-paradigm, it's functional but it's also 3 other things that muddy the water a bit. Especially considering most programming languages have those neat helper methods or stdlib implementations that basically bring functional programming without changing the language much.
- jackhack 9y agoJS may be capable of a pure functional programming style, but from 20 years of observing it's use (and misuse), functional JS is an exceptionally rare occurrence; an edge case.
- maze-le 9y agoJavascript may have some functional concepts (mainly, functions as first order objects) but the programming style of most common javascript projects is not functional. This is with the notable exception of event-driven frameworks and precompiled languages like purescript.
- ape4 9y agoYou need good garbage collection for functional programming. Now we have good garbage collection.
- fhood 9y agoWell for comparison, GC was a yes right. And basically every popular (modern) language incorporates garbage collection. Functional programming, or at least fairly strict functional programming, still hasn't really caught on. Of the juggernaut languages, C/C++, python, Ruby, Java, JavaScript none are truly functional (I don't use JavaScript but the code I have seen in it doesn't often look functional). Until something like Scala cracks the top 5 I agree with calling it a maybe.
- paulddraper 9y agoWhat makes Scala decidedly functional and JavaScript or Ruby not?
- charlysl 9y agoJavaScript and Ruby are functional too. Scala supports other paradigms than FP too. They are all multi-paradigm. The difference is that certain programming styles might be more natural in some languages than in others.
- fhood 9y agoWell, the first listed paradigm for Scala on wikipedia is functional, JavaScript and Ruby both have OO followed by imperative. And anyways supporting functional programming and being designed for it are not the same thing. Yeah, I can right functional Ruby, but that isn't going to be by initial inclination when writing a Ruby script. It would be for Scala.
- charlysl 9y agoSure, this is what I meant by natural. Just one thing: when you write that Ruby script, could one of the reasons why you don't use a FP style be not only that maybe it wouldn't be natural to do so in Ruby, but also that it's unsuitable for the kind of problem you are trying to solve with that script to begin with? I mention this, because I have the impression that people tend to believe that to solve a programming problem you should use whatever paradigm is perceived as the main one for the language at hand. However, I believe that it's the problem that should dictate the paradigm.
- charlysl 9y agoJava has been multi-paradigm since the beginning, although it favours a stateful style for sure. FP is by no means restricted to purely functional languages. My impression is that the ideal approach is to use the paradigm most suitable for the problem/component at hand (principle of least expressivity), so I prefer multi-paradigm languages over pure ones, although of course I understand that there are domains where one can benefit from the optimizations made possible by purity. Understanding how to do this requires much more of a learning effort, learning more concepts, techniques and idioms, which I suspect is why FP is still lagging; I don't believe it is for any fundamental reason. The other thing is that there are many more programming paradigms than just functional and stateful.
- throwawayjava 9y agoNot to mention, these languages actually work for many, many domains. A shit-load of C# could just as well be F#. In fact, lots and lots of people do use F#/Scala/OCaml/etc. to build real systems. Just because something isn't "the most popular" doesn't mean that thing doesn't work.
- Tomis02 9y agoI think it's important to make the distinction between a successful idea and a good one. For example OO as a paradigm in mainstream languages (C++, Java) has been very successful, despite it being more often than not a bad idea (e.g. horrible inheritance hierarchies are still implemented in this day and age, with dire consequences on code quality). In OP's article, OO is filed under "what works", which I strongly disagree with. If anything, software development works DESPITE OO, which in my experience constantly hinders progress because of rigid architectures.
- charlysl 9y agoI don't believe that the problem is OO in itself, but the way in which it is often used. You can write a bad program in any paradigm, and a good one too. FP is less popular and tends to attract a more curious crowd, who is more willing to learn how to use it well, whereas OO languages are used by everyone. On top of that, OO is build on top of a more expressive computation model, the stateful one, which because of its power is much more difficult to use well (and easier to abuse) than the much simpler functional/declarative model.
- Tomis02 9y ago> I don't believe that the problem is OO in itself, but the way in which it is often used. That's similar to what proponents of communism have been saying - "it does work if you do it right". The problem is that things start breaking down as soon as the project scale. For small programs a pure OO model can work, but increased complexity means people will definitely switch to a hybrid OO-(procedural|functional) style, simply because pure OO is untenable in large codebases.
- charlysl 9y agoHaha, communism. Communism failed in Russia. But democracy failed in Russia too. Was communism the problem? I am half kidding, but I have wondered sometimes ...
- raiflip 9y ago
- twblalock 9y agoThe Java 8 lambda syntax is all objects under the hood, and the Haskell "do" notation is all functional under the hood. It's impressive that both languages are able to accommodate other programming paradigms while remaining pretty much the same under the hood.
- moron4hire 9y agoNot really? It's turing complete turtles all the way down. I leave this article out whenever people start talking "OOP vs FP": https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/ https://eli.thegreenplace.net/2016/the-expression-problem-an...
- eternalban 9y ago"It's impressive that both languages are able to [efficiently/effectively] accommodate other programming paradigms while remaining pretty much the same under the hood."