Once you're dealing with a lot of code that has both a lot of external library/datasource dependencies AND you want to write good, thorough tests around it... what's the alternative to doing something like DI/Factory stuff? At some point you hit the point where you need to interact with the stateful, non-functional outside world. I completely understand why people invent things to avoid having to pass every single thing needed at every single layer as arguments into the topmost method call to get sent all the way down.
I couldn't tell you off the top of my head exactly why any Java code here would need a Provider here vs a Factory there vs a FactoryFactory in some other place, but... without further information on what these classes were actually doing, I'm gonna withhold judgement. Once you've got words like that three deep on the end there's probably room for some refactoring, sure... but is it the most pressing thing that causes headaches when modifying the code? I doubt it.
> what's the alternative to doing something like DI/Factory stuff? At some point you hit the point where you need to interact with the stateful, non-functional outside world.
More DI and more Factory, I kid you not. If I’ve learned anything from FP, there’s nothing you can’t solve by passing contained references to things that make more things. If it ever becomes cumbersome it’s also a great forcing function to reconsider everything you think you know and whether you want to keep knowing.
I couldn't tell you off the top of my head exactly why any Java code here would need a Provider here vs a Factory there vs a FactoryFactory in some other place, but... without further information on what these classes were actually doing, I'm gonna withhold judgement. Once you've got words like that three deep on the end there's probably room for some refactoring, sure... but is it the most pressing thing that causes headaches when modifying the code? I doubt it.