r/javascript • u/ilya_ca • Jul 29 '19
Functional Programming? Don’t Even Bother, It’s a Silly Toy
https://medium.com/@ilyasz/fp-toy-7f52ea0a947e3
u/skwacky Jul 29 '19
Lots of good laughs in here, thanks for sharing!
I can't quite figure out how to lay caviar though, could we get some documentation on this?
3
u/Bac0nnaise Jul 29 '19
I was so confused about the tone of the article until I got to
class AppleFactory extends AbstractFruitFactory
3
u/ITS-A-FAKE Jul 29 '19 edited Jul 29 '19
Jesus, what a disgrace. Like others said, fanatism is never a good thing.
I know from experience that loud fp programmers tend to be extremists. I ne-ver have heard any oop programmer brag about it.
Do you have to cram classes everywhere to do oop? Not really. In multi paradigm languages you could... Use either when it's needed!
Please, oh please stop using lodash, ramda whatever, tens of import for filtering, reducing stuff. It's completely dumb. Es6 brings it naturally. I am sorry, I have been burned by this kind of people.
import { assoc, defaultTo, map as fmap, forEach, groupBy, head, ifElse, invoker, merge, nth, path, pipe, prop, propEq, propOr, range, reduce, sortBy, values} from 'ramda'
Bwahaha, it's an actual sample from a redux store.
You can bring it as 'satir' or whatever you want, stop despising others and start asking yourself if you are doing the 'simplest' thing.
You can give me rxjs all day long, I will always wonder what's the point when you could use godsend like vuex.
IMHO functionnal programming tends to be the panacea for people wanting ~more~. Something more engineered. You have to learn new stuff but what about readability, maintainability?
Less lines DOES NOT make your code better. Make a short, readable, scalable code. That's what count on the end.
Think about devs having to support your software later.
Bring the downvotes!
Peace
1
u/notNullOrVoid Aug 01 '19
Please, oh please stop using lodash, ramda whatever
Really though all these utility libraries add extra cognitive load. Without them it can all be written in roughly the same number of lines, while also being more explicit about what's actually going on.
There's also the impact on performance. Function calls are not free, nor are they cheap when manipulating large sets of data.
1
u/JonasLuks Jul 29 '19
What the actual... Talks about Enterprise needs and self-respecting developers and bashes SQL? I guess I'm missing something...
3
u/recursiveCreator Jul 29 '19
yeah, it’s satire..
2
u/JonasLuks Jul 29 '19
I thought it was some Onion-like shit. I didn't want to believe that based on some developers I know.
0
Jul 29 '19
[deleted]
1
u/nschubach Jul 29 '19
People have been warm to FP guys, respectful and open to their ideas, always careful to listen
Yep... I cringed the whole read. I'm a huge fan of FP, but I totally get that people were taught and learned OOP for the past few decades so the legacy is there.
5
u/zachgarwood Jul 29 '19
A couple mild chuckles in there, but I'm perpetually confused by this "OOP vs FP" holy war people are trying to drum up. They're not contradictory paradigms, they're complementary. Most languages (that I'm familiar with) allow for the use of both styles, when appropriate, because, well, FP has been around for forever. So I'm not sure where this weird notion comes from that FP supercedes OOP, or the backlash that OOP is more practical than FP. I truly don't get it.