4 ms·
Overcomplicated abstraction (e.g., DI frameworks) and unnecessary abstraction are not anyone's friends.
by sidlls 4y ago
Overcomplicated abstraction (e.g., DI frameworks) and unnecessary abstraction are not anyone's friends.
- Sohcahtoa82 4y agoFrom what I understand, DI simply turns this: public class MyClass { private Dep myDep; void MyClass(){ this.myDep = GetDep(); } } into this: public class MyClass { private Dep myDep; void MyClass(Dep dep){ this.myDep = dep; } } Why this needs an entire framework is beyond me. It feels like all they do is convert explicit code into boilerplate which then becomes much harder to reason about.
- confidantlake 4y agoI think the theory is when you want to change the dep you can do it in a config file instead of in the code. But I totally agree, I don't think the value is worth the cost.