3 ms·
DI makes testing nice. People approximate it with hacks, but you need DI for truly good unit tests.
by Aeolun 5y ago
DI makes testing nice. People approximate it with hacks, but you need DI for truly good unit tests.
- Akronymus 5y agoReally depends on the whole structure. If it is mainly FP, dependency rejection usually is actually the easiest to test with
- Aeolun 5y agoI dunno how you can combine dependency injection (as I imagined it in the original comment) with FP in the first place. Without classes what would you be injecting? Other functions? That’s still something that happens all the time in FP.
- Akronymus 5y agoI was thinking sideeffectful functions. Such as DB accesses.
- layer8 5y ago> dependency rejection That’s secretly the most powerful design strategy.
- Akronymus 5y agoIt objectively isn't, as there are certain things you can't do with it. Altough, for usability it is IMO definitely the best.