re: Code Organization in Functional Programming vs Object Oriented Programming VIEW POST


Re-read the article and I have a question on side-effects:
Looks like you are ignoring it or am I wrong?
Can you share a little how you think the impurity in your examples should be addressed?


There are a few ways to handle them. In the article, I just use Promises.
The other way is to use Dependency Injection where things like fsModule, JSON.parse, and even request style things you make them part of the function parameters.
The other way is using the Effect functor. That's a lot of work in JavaScript without using libraries/languages that help you handle that (a la PureScript).
To learn more about DI and Effect: jrsinclair.com/articles/2018/how-t...


Thanks for the response!
I actually stumbled upon this post after asking you here and found it very helpful.
My conclusion after reading it and a few others was that side effects are not to be eliminated just to be minimized.
Where it is clear that there should be side effect I just leave it

Code of Conduct Report abuse