I believe this ties into Joshua Bloch's "good APIs have good
defaults" paradigm (I remember him saying this at some point). In other
words, don't make the user do anything that you can reasonably do for
him automatically. I don't know whether it applies in this context but I
suspect it does. I don't think there is any danger that the lack of
@Inject will somehow reduce the readability of the code. It is pretty
clear that if there is only one constructor and Guice somehow constructs
an instance of that class than it must obviously be using that constructor.
I might buy that explicit @Inject has other benefits, but I don't
see the readability argument.
Gili
Bob Lee wrote:
> Guice prefers explicit annotation over convention. When you consider
> that many people read your code many times while you only write it
> once, is adding @Inject really such an imposition?
>
> On Tue, Oct 14, 2008 at 3:18 PM, Gili Tzabari <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> On the flip side, if you require @Inject why not go the extra step
> of requiring developers to provide an explicit constructor with a
> @Inject annotation? The current behavior "breaks compatibility" when a
> user introduces a custom constructor for the first time.
>
>
> The same is true for plain Java.
>
> Bob
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" 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?hl=en
-~----------~----~----~----~------~----~------~--~---