4 ms·
I didn't downvote you, but I have a hard time either understanding your meaning or imagining the scenario you describe. Can you give an example? OOP functions
by z9znz 4y ago
I didn't downvote you, but I have a hard time either understanding your meaning or imagining the scenario you describe. Can you give an example?
OOP functions are usually harder to test because they expect complete objects as arguments, and that tends to require a lot more mocking or fixtures/factories to setup for the test.
FP functions typically operate on less complex and more open data structures. You just construct the minimum thing necessary to satisfy the function, and the test is comparatively simple. None of this has anything to do with global data. Using global data from within any functions is generally a bad idea and has nothing to do with FP or OOP.
- commandlinefan 4y ago> FP functions Pure functional, yeah, absolutely - that’s not what I usually see though. I see procedural/iterative static functions that connect to static data that connect to live databases and immediately start caching its contents locally.