I wrote that article to introduce FP to anyone who wants broaden their knowledge. By knowing another paradigm, we will get the right tools for the right jobs, right?
I wrote that article to introduce FP to anyone who wants broaden their knowledge. By knowing another paradigm, we will get the right tools for the right jobs, right?
> I'm not trying to tell imperative is bad
"In another word, the imperative one is an annoying micromanager" ;)
> By knowing another paradigm, we will get the right tools for the right jobs, right?
Yes, if you not only introduce the paradigm, but tell them when it makes sense to use it. I haven't seen it in your article.
> According to sample number 2 above, we will read the loop 4 times to track the current value of sample. Imagine if you have an array with 1000 elements inside it.
That is one of that.
> ...made our code more concise
and also in the summary. Well, I know maybe "concise" is a subjective thing :)
I don't always prefer concise code. It means that I have to keep everything in my head, what the function does exactly.
So what I miss is real use cases. Would you write a video editor in FP? Would you make Quake 4 in FP? Is it good for Todo apps? CLI apps maybe? Or is it best for 50 line microservices?
Btw, is using map, filter, reduce considered as using FP too? I always use it in my Swift and JS code.
One of the thing that I can't use FP is in embedded development (arduino and esp8266).