4 ms·
The system is composed of classes which are nicely encapsulated, independent and obey Liskov substitution and all that. You can connect them in different arrang
by kazinator 1y ago
The system is composed of classes which are nicely encapsulated, independent and obey Liskov substitution and all that. You can connect them in different arrangements and they play along nicely.
But then some classes which use other classes hard code those classes in their constructor. They then work with those specific hard-coded classes. It's like if someone crazy-glued some of our Lego blocks together.
We recognize this problem and allow the sister objects to be configurable.
Then some opinionated nubmnut comes along and says, "hey, we should call this simple correction 'dependency injection'". And somehow, everyone listens.