I am designing a complex batch core process. The process will call depending on some logic several functions to enquiry the Database and return massive data. This data will be heavily manipulated for this core batch process. These functions are out of my scope so I cannot modify them.
I was thinking to develop this batch process using functional javascript style. Though, I am struggling to see a reasonable design solution in pure functional programming. I have seen 3 options:
1.- Pure functional: Call all the Data impure functions at front and inject the data to the functional core batch process. This looks totally unrealistic as I don't know the data that I will need to get upfront. Part of the batch process is to coordinate which calls to make.
2.- Pragmatic functional: pass the impure data functions as parameter of the Batch core Process. I think this break the strict rules of funcional programming as I am injecting impurity into the pure functions... though I can still unit test the core batch process by mocking the database function parameters.
3.- Using lazy evaluation techniques to postpone side effects outside of the Batch Core functionality: Using ramda and fluture. As an abstraction could make sense though I am not totally bought because it adds complexity. I will need to create a layer to convert promises to lazy flutures... and specially the code doesn't look like javascript and will be more difficult to read by other people in my company.
Am I missing any aha approach in functional programming? Which one you think it is better...