I just usually do applications for myself as a hobby. It looks like DI frameworks have a big momentum in the community, so I thought maybe I should learn it to improve my coding skills. From what I understand, it seems to be geared more towards big projects. Is it still a good idea to use it for example in a 5k lines project?
I use DI for all code I write, no matter the size.
However, you should be aware that DI does not require a DI Container. A DI Container certainly helps (especially on big projects), but you can also write container-agnostic code using DI principles.
The size of the code base doesn't really matter. What matters is maintainability. DI enables loose coupling that again enables maintainability. For all but one-off, throw-away projects, that's valuable.
Yes - dependency injection promotes loose coupling and testability which is useful for a project of any size, and the overhead of configuration is relatively small.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With