@fuck_u_spez@lemmy.fmhy.ml to Programmer Humor@programming.dev • 2 years agoEveryone should have a tool-building factory factory factoryi.ibb.coimagemessage-square49fedilinkarrow-up1510arrow-down114
arrow-up1496arrow-down1imageEveryone should have a tool-building factory factory factoryi.ibb.co@fuck_u_spez@lemmy.fmhy.ml to Programmer Humor@programming.dev • 2 years agomessage-square49fedilink
minus-square@tatterdemalion@programming.devlinkfedilink2•2 years agoDo you write unit tests with objects mocked via interfaces? Or polymorphism via interfaces? Those are the main reasons to use DI.
minus-square@fuck_u_spez@lemmy.fmhy.mlOPlinkfedilink1•2 years agoI guess I have to start calling function invocation with generic parameters, fancy names (like “dependency injection” ^^)
minus-square@qwioeue@lemmy.worldlinkfedilink2•2 years agoRelevant: I also prefer the simpler explanation. https://www.jamesshore.com/v2/blog/2006/dependency-injection-demystified
minus-squareEthanlinkfedilink1•2 years agoI use various strategies depending on what seems appropriate, including the two you mention. I’ve never felt the lack of DI.
Do you write unit tests with objects mocked via interfaces? Or polymorphism via interfaces? Those are the main reasons to use DI.
I guess I have to start calling function invocation with generic parameters, fancy names (like “dependency injection” ^^)
Relevant:
I also prefer the simpler explanation.
https://www.jamesshore.com/v2/blog/2006/dependency-injection-demystified
Yea that works too.
I use various strategies depending on what seems appropriate, including the two you mention. I’ve never felt the lack of DI.