DEV Community

Discussion on: Practical Functional Programming in JavaScript - Why it's worth it

richytong profile image
Richard Tong Author • Edited on

For me at least, I have always believed there is an optimal (in every sense of the word) way to express everything in every context. Functional programming begins to solve that problem, and JavaScript solves that problem on another level.

The truth is there will be times when it's more optimal and readable to write imperative style code (for loops, let index ..., etc). I'm partial to while loops myself. That's the beauty of JavaScript - you can mix paradigms and apply them where it makes sense. I think it requires trying things out and evaluating everything as honestly as possible.

When you say that functional programming scales well, do you mean that it scales well in the same sense that TypeScript scales well (largerish shared codebases)? I suppose one of the premises to functional programming is that there is such a way such that code is reused as optimally as possible, and by virtue of simplicity it would indeed scale well.