← Back to context

Comment by tyleo

1 day ago

I don’t think I’ll ever understand the affinity for DI libraries. I write a lot of tested code but it’s always just plain old interfaces and constructor arguments for me.

Other parts of our org use a DI framework and I feel like it causes a new class of dependency ordering bugs or missing dependencies. These just don’t exist when everything is passed in the ctor.

> I’ll ever understand the affinity for DI libraries

DI addresses/can address/affects more than 10 different aspects of application lifecycle. We've described our reasoning in several talks linked at https://github.com/7mind/izumi?tab=readme-ov-file#docs

> I feel like it causes a new class of dependency ordering bugs or missing dependencies

That's precisely where phased approach shines.

Agreed. Modern Spring brags about not requiring pages of external XML files like it did in the old days. But plain constructors is still an improvement on both.

  • Configurable apps (see "axis" and "role" concepts in distage) are prohibitevely hard to setup and maintain, dual test with sound opt-in memoization are, probably, practically impossible.

  • It just gets rid of the boilerplate. Never had a problem with ctor injection in Spring.