3 ms·
The majority of programming today is not functional at all. I think Functional programming became sort of a tertiary elitist buzzword similar to drunken style k
by crimsonalucard 7y ago
The majority of programming today is not functional at all. I think Functional programming became sort of a tertiary elitist buzzword similar to drunken style kung fu. The effectiveness of the style is well known among practitioners and those that don't practice it look upon it as if it was a foreign and strange art.
What people don't realize is that functional programming is mixed martial arts. The art of combat brought down to the science of combat. I think there is little chance FP will become mainstream. MMA didn't become popular because it was the most effective art, it became popular because it was packaged up into entertainment.
- dnautics 7y ago> The majority of programming today is not functional at all. That's probably true. > I think there is little chance FP will become mainstream That's demonstrably not, as React has basically gone full FP. I would argue that the majority of bootcamp students are now taught functional programming.
- crimsonalucard 7y agoBoot camp and react aren’t mainstream programming. Also react isn’t full FP.
- dnautics 7y agothat's a no scotsman argument. You could claim erlang isn't full fp because you have a stateful process attribute dictionary, and, while we're at it, access to network resources like a Postgres database, but that would be an almost meaningless statement. With Hooks, react basically went full FP. You can still make an object component, but it is frowned upon.
- crimsonalucard 7y agonah not even going there. JS, is not functional therefore react is not functional. In all intermediary state in between interfaces to the framework you are allowed to have mutating state. So you actually have freedom to do any style in JS. I don't know react to well but I do know 100% that a function with this name is possible in react: function closedFunctionThatdoesSomeImperativeAlgorithmWithMutatingInternalState(x: number): number Right? This is totally legal and not even a niche use case so you can do whatever the hell you want in react. It's the interface to the framework that is supposedly FRP. This is NOT the case for most functional languages. Also if you think all FP is just immutable state then you don't see the full picture. Immutable state creates an isomorphism between imperative programming and functional programming. Thus many bootcampers following the buzz end up just making all their variables immutable and thinking they figured it all out. Yes, immutability forces the usage of higher order functions and recursion. This surface level knowledge also doesn't really provide any intrinsic benefit to programming. Recursion, map or reduce is not intrinsically better than a for loop or a while loop. Most of these beginners just subconsciously obey the buzz without ever realizing that that the buzz makes no sense. These guys don't even know what "function composition" means. Because most of these programmers don't understand why FP is better, they don't use it properly and as a result this popularity of FP among react users is just a fad. Definitely not mainstream.
- dnautics 7y agoThat's wrong. The "surface level knowledge" prevents huge classes of footguns, and that's why it's not just a fad. I can, have, and am about to take a junior and put them into prod without losing sleep far faster in FP land than I can in OO land. This is a real improvement that I as a developer who has complete ownership over a project care about.
- crimsonalucard 7y agoYou think OO patterns disappear in FP land? I can dependency inject my code to hell in FP just as fast as in OOP. I can pass first class functions around and effectively bring over all the problems from OOP land to FP. It is a fad because FP issues new foot guns to blast your head completely off. FP without types and without understanding isn't a huge improvement over procedural programming or OOP. You're already hearing about programmers not buying into the whole FP fad largely because of there experience with FP on react and other similar platforms.