I agree with you totally. These days, my team usually will be working with React and we stick with pure functional programming as much as possible. However in the past I have had times where a closure would work, but in that case I actually would opt to use the new keyword and made instances of a Thing that all have internal scope, but could be observed and interacted with. It's really just a question of preference and using the right tool for the job.
That’s probably the better option, both for transparency and for memory safety. But I’m definitely on board the functional programming train nowadays, especially with React.
1
u/lostPixels May 28 '19
I agree with you totally. These days, my team usually will be working with React and we stick with pure functional programming as much as possible. However in the past I have had times where a closure would work, but in that case I actually would opt to use the
newkeyword and made instances of aThingthat all have internal scope, but could be observed and interacted with. It's really just a question of preference and using the right tool for the job.