4 ms·
DI buys you maintainability. Without DI, there's too much flexibility in how objects get constructed. If you want to add new functionality to a legacy code bas
by cbarrick 3y ago
DI buys you maintainability.
Without DI, there's too much flexibility in how objects get constructed. If you want to add new functionality to a legacy code base, it can be difficult to track down the different integration points and slow to plumb through your dependencies. These projects can turn into spaghetti very quickly.
DI solves this with a simple recipe: define your functionality, define your dependencies, wire it up to the injector.
The pattern is useful in all OO languages, Python and C++ included.
- riku_iki 3y agothe problem is that those DI frameworks are all adding substantial amount of complexity and brain load. I started using just static factories in my code, and abandoned all those DI and it works well enough.
- andrekandre 3y ago> I started using just static factories in my code, and abandoned all those DI and it works well enough. i have done this as well (though not in java), it makes knowing what gets initialized how and where much easier and faster to debug