Preferences

You're right, most of the downsides are specific to runtime wiring. I haven't used dagger. It does compile time magic doesn't it?

Yes. If you do something wrong in your wire-up then the code won't even compile. Definitely look into it. Like you, I have a healthy distrust of DI frameworks because of the many errors that get pushed to runtime, but Dagger's not bad.
(Disclosure: I work on Dagger in my 20% at Google.)

What's more, Dagger gives you (compile-time) insights into the graph of dependencies.

For example, we've hooked up our internal code-search tool to give you Dagger cross-references, so if you (e.g.) click on a parameter to an @Inject constructor, you'll see the place that provides that object.

Also, if you click on the @Component, you'll see a visualization of the entire graph.

We're working on surfacing these hooks in the open source repo, which would allow IDEs like Eclipse to gain this functionality as well.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal