Re:Compile-Time DI vs. Run-Time DI
by JetSpiegel on Tuesday April 30, 2019 @01:25PM
(#19789968)
> what do you do if your client / boss tells you "I want to configure the plug-ins & classes availables in the software through some file editing without having to recompile anything" and your codebase is in C++ / Java / Go / D / Rust ...
You compile all the (tested) combinations as static executables and shove them all into the release package.
Yes, in that case you probably need to parse a config file.
But you might also encounter DI config files for specific environments, like development where you inject MockMailer, TrivialLogger and InMemoryDatabase instead of RealLifeMailer, CloudLogger and ActualDatabase.
well, then how do you do it ? what do you do if your client / boss tells you "I want to configure the plug-ins & classes availables in the software through some file editing without having to recompile anything" and your codebase is in C++ / Java / Go / D / Rust ...