Until you want to add an argument to that constructor and find yourself modifying lots of files just to update that call everywhere.
Or need a value from the application config, and have to patch the configuration instance through, several levels of classes deep. After wasting a day or two with those shenanigans, you’ll gladly take the DI framework, which makes both scenarios a single-line, 10 second change.
9dev|3 years ago
Or need a value from the application config, and have to patch the configuration instance through, several levels of classes deep. After wasting a day or two with those shenanigans, you’ll gladly take the DI framework, which makes both scenarios a single-line, 10 second change.
ars|3 years ago
The one that doesn't does whatever magic you were planning for the DI, does that, then calls the constructor with the arg.