Functional programming in Javascript is an antipattern
Alex Dixon
1K54

Nice article. This pulls at my heart strings a little. I encounter the same woes on a daily basis with React, Redux, and ImmutableJS. And I agree in a utopian universe Javascript would be a functional first-class language that ran natively in the browser.

Yet in the trenches, the reality of dealing different languages and libraries is very situational and dependent on many factors. Many devs aren’t dealing with a green-field app so introducing new tech is very tricky.

I still believe for my team, a incremental approach to functional programming is still better albeit ultimately more complex to deal with. We use Flow which aides in knowing what type of data structures we’re dealing with. And ImmutableJS still has significant advantages in terms of enforcing immutability, O(n) operations, memoization, and nested accessors.

What I also find daunting with switching to another functional language is the fact that in this comment section alone people have mentioned like 4–5 different languages to try. I find that just as fragmented as all the other functional JS libraries.

And as much as people say the language is interoperable with existing JS, in my experience there are always gotchas with interfacing to existing libs and the DOM API itself.

I suspect if/when web assembly becomes fully supported, then compile-to languages will become more tenable. Although, this may end up causing more fragmentation since virtually any source language will be on an even playing field.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.