Hacker News new | ask | show | jobs
by throwaway2037 1528 days ago
Caveat: I always avoid DI frameworks / libraries if possible. I just add an AppContext to all of my projects, then write "10,000 new()'s" in one place. That is my wiring. That said, I don't want to hate on people who are productive with DI frameworks / libraries. There is more than one way to do it well!

Real question: When Google Guice came out, there was a hype about it was better than Spring DI. Honestly, I think part of the hype came from their amazing PR, courtesy of "Crazy Bob". Have you tried it, and what did you think? If not, what other DI frameworks / libraries have you tried? Why did you prefer Spring? I am throwing zero share here. I am genuinely curious!

1 comments

It's been a while since I last was experimenting with them. I did try Guice briefly, but I stopped for some reason that I don't recall now. Perhaps I should have given it more time. Dagger I tried in a bit more detail, and I found the code-generation aspect of it to be unpleasant and not sufficiently abstracted. I don't know if that could have been addressed by IDE configuration, plugins, etc, but I had to stop working on that project.
It is interesting that you wrote <<I don't know if that could have been addressed by IDE configuration, plugins, etc>>. This is another thing that I don't like about DI frameworks. Usually, they require heavy IDE integration. (I recall this is less true for Guice.) Don't get me started about old school Spring XML...