Dependency injection has significant upsides, but the indirection also has significant downsides for direct readability and traceability. Suddenly, you separated definition and call into distanced registration and use, with magic indirection that may or may not use various lifetime behaviors or proxying and wrapping or later replacement on types.
I’ve tried reading (and fixing) a library that made excessive use of DI, and it was very hard to follow or get into.
Dependency injection has significant upsides, but the indirection also has significant downsides for direct readability and traceability. Suddenly, you separated definition and call into distanced registration and use, with magic indirection that may or may not use various lifetime behaviors or proxying and wrapping or later replacement on types.
I’ve tried reading (and fixing) a library that made excessive use of DI, and it was very hard to follow or get into.