3 ms·
On larger code bases it can help a lot. You get to a point where you need that config object over in some random function and you start weaving it through const
by shellac 12y ago
On larger code bases it can help a lot. You get to a point where you need that config object over in some random function and you start weaving it through constructors. At which point a simple DI system really appeals.
DI code also tends to be more pleasant to test in my experience since it promotes loose coupling.
- ExpiredLink 12y agoQuite the contrary as repeatedly experienced in Java land.
- fishnchips 12y agoI believe there are other ways: http://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html http://commandcenter.blogspot.com/2014/01/self-referential-f... And you should probably avoid situations where you suddenly need config objects in 'random places'. This could be a symptom of chaotic API design. But then again, whatever works for you.