3 ms·
Functional programming constructs helps you write simple code faster, and clarify the algorithm. It is easier to rearrange, to test and to reason about, but it
by linkdd 6y ago
Functional programming constructs helps you write simple code faster, and clarify the algorithm.
It is easier to rearrange, to test and to reason about, but it is harder to read.
Once your fast-written code works, you obviously need to optimize it where it's needed. And if you map/filter/reduce is your bottleneck, just get rid of it obviously.
But I highly doubt it will be your bottleneck.
Nested anonymous function that rely on scope closure is THE way to truly encapsulate your data, example: https://pastebin.com/JrAP6yGP https://pastebin.com/JrAP6yGP
IMHO, the factory pattern is a clearer/easier pattern than Javascript's classes/prototypes.