Hacker News new | ask | show | jobs
by irahul 5100 days ago
Injection by parameters(setters, constructor and simple params) has been in use much before DI became a fad.

    void qsort(void *base, size_t nmemb, size_t size,
               int(*compar)(const void *, const void *))
Here, `compar` is being injected. When it is needed, it's sweet. But when you start going down Java's way(i.e the way Java frameworks (over)do it), it's irritating. The point of DI is to inject dependencies rather than hard coding them. That doesn't mean you have to use IoC containers, or you have to inject everything.
1 comments

Curious to hear which Java DI frameworks you dislike. I've used Google Guice before on a large project and I found it to be great: it doesn't get in your way and it makes your code a lot more modular and testable.