On 27/04/10 01:25, Sam Berlin wrote:
The example that continuously pops up in support of these issues is
injecting a logger. Are there any other valid use-cases? Injecting a
logger is very easily worked around by injecting a LoggerFactory that
has a getLogger(Class) method that returns a logger. (And if
LoggerFactory itself needs injected parameters, it can be bound using
AssistedInject.) I suspect the same can be said for any other use-case
(although I haven't seen other use-cases listed).
Ultimately, I believe the pain and degenerate code that can come from
enabling such a feature seem to be far, far worse than the pain that
comes from not having the feature.
I think the reason it keeps coming up is that Guice core knows how to do
an injection (java.util.logging.Logger) which a Guice user absolutely
cannot configure a similar injection themselves. I certainly don't like
this fact.
As far as the pain and degenerate code argument goes, the feature would
just be a tool, that can be used well or poorly. Guice already supports
AOP, which excels at causing pain if used without wisdom - this would be
no different.
Max.
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.