Jump to content

Talk:Google Guice

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Untitled

[edit]

Why is this so uncertain? There are plenty of other articles about Programming Frameworks. --208.14.28.76 21:07, 30 April 2007 (UTC)[reply]

Spring is not limited to XML configuration

[edit]

Well, it isn't. That's hardly a fair comparison to make —Preceding unsigned comment added by 195.80.10.42 (talk) 16:47, 29 November 2007 (UTC)[reply]

Changes to annotations not necessary

[edit]

"Guice-like dependency injection, on the other hand, requires changes to the annotations, i.e. the source code, when you want to inject a different implementation of some service, and annotations require additional imports in the source code."

This is not true. You can create a Module that uses Binder to bind an implementation to an interface. See this example form Guice User's Guide:

public class MyModule implements Module {
  public void configure(Binder binder) {
    // Bind Foo to FooImpl. Guice will create a new
    // instance of FooImpl for every injection.
    binder.bind(Foo.class).to(FooImpl.class);

    // Bind Bar to an instance of Bar.
    Bar bar = new Bar();
    binder.bind(Bar.class).toInstance(bar);
  }
}

77.253.8.178 (talk) —Preceding comment was added at 15:43, 23 June 2008 (UTC)[reply]

Questions from Guice talk

[edit]

On slide 16 from the talk, you show dependency injection without a factory, but then on the next slide you show a factory. Why is there a factory on slide 17? Why is a factory necessary since you show it working without a factory in slide 16?

On slide 18, why don't the dependencies blow up just like in the factory example (slide 12)? The left half of slide 18 looks identical to the slide 12 dependencies that did blow up.

On slide 32, you explain bind(TweetClient.class); as once you add @Inject to a constructor it would make it so "all the dependencies of that constructor will be filled in by Guice." This seems ambiguous. "All the dependencies of that constructor" makes it seem like you mean the parameters that are passed in. If so, how does guice know what to bind the parameters to without their own bind statements? It seems like you say two things, first you make it seem like bind(TweetClient.class) is binding TweetClient to itself so that when other classes reference it, they should just construct whichever TweetClient constructor has the @Inject annotation. But then you say "dependencies of that constructor" which makes it seem like you mean bind(TweetClient) somehow figures out what to do with the dependency interfaces in the constructor itself. Which is it?

On slide 48 you talk about mixing scope with providers. "This is where you have a singleton object that's sort of the overseer of everything. But it kind of wants to know who's asking who the current user is or what their session contains. And so you can inject a provider of user or a provider of session, and then use that to look inside." Why inject a provider into the singleton? Why wouldn't the singleton just use method injection without a provider? Wouldn't that be less code?--140.203.154.5 (talk) 01:09, 1 September 2010 (UTC)[reply]

pronounced like juice?

[edit]

in what language? not in English, and not in Italian, either. The guys at Google seem to have no understanding of linguistics at all. 93.219.169.162 (talk) 04:48, 26 September 2014 (UTC)[reply]