Re:You probably don't need a dependency injection framework
by layer8 on Sunday May 25, 2025 @05:48PM
(#44091502)
How do they solve that? If constructors require certain parameters, someone has to pass them. If it’s not a top-level object, the instantiating code will pass it and have a corresponding constructor or method parameter itself. At the top level, main() or equivalent will pass the parameter. Where is the problem?
[ Parent
| on HN ]
Re:You probably don't need a dependency injection framework
by baq on Monday May 26, 2025 @05:48AM
(#44095711)
Exactly, there is no problem when you do it this way and DI frameworks force you to.
The problem when you don't do it this way is when you depend on order of initialization in a way you are not aware of until it breaks, and it breaks in all kinds of interesting ways.