@4:15 Another way would be to have overridable (i.e. non-final) methods that return a Shortener (and another one that returns a Tweeter). That way, you can write a subclass that overrides those methods with their own implementations that return mocks, or whatever.
@7:38 But if you are using JUnit (and it looks like you are), you can (and probably should) perform setup and tear down in the setUp and tearDown methods.
what about just making one big singleton factory instead of the guice-module/injector for the case of a medium large application... seems like a good solution for me, instead of many small factorys ;-) but nice project btw :-D
@Discofunk007 You can now use annotations provided by JSR-330, such as javax.inject.Inject. If you don't want to do that, you can always fall back on writing a @Provides method for constructors that you want to inject, but that don't aren't annotated with @Inject. For example, @Provides TweetClient provideTwitterClient(Tweeter tweeter, Shortener shortener) { return new TweetClient(tweeter, shortener); }
At around 7th minute Jesse says if you compile a module you have to compile everything that it depends on?!!! it's not true. Test for yourself if you don't believe me. Define a class and inside one of the methods call another class that you've defined compile it. Then see the time of creation of the class files. Then go back and change the dependent class and compile again. It will still work without needing to compile the other class again. IDEs also keep track of these dependencies
Nope, he couldnt use else in this method, because text local variable can be changed in the first if block of code (see: text = shortener.shorten(text);).
Comment removed
clintonselke 1 week ago
The presentation shows Hollywood sign :)
GirlieBlues 3 months ago
@4:15 Another way would be to have overridable (i.e. non-final) methods that return a Shortener (and another one that returns a Tweeter). That way, you can write a subclass that overrides those methods with their own implementations that return mocks, or whatever.
allyourcode 4 months ago
@7:38 But if you are using JUnit (and it looks like you are), you can (and probably should) perform setup and tear down in the setUp and tearDown methods.
allyourcode 4 months ago
You stole my name: Jeffrey Pipes Guice!!!! Check out my Facebook page called Jeffrey Pipes Guice.
jeffguice1959 5 months ago
what about just making one big singleton factory instead of the guice-module/injector for the case of a medium large application... seems like a good solution for me, instead of many small factorys ;-) but nice project btw :-D
berndhuber98 6 months ago
At 44:58 he says "ninety" like a robot.
slugmandrew 7 months ago
Comment removed
Discofunk007 7 months ago
Don't like that there is a dependency on Guice for the annotations (or is there?). Should default to use the constructor with the most parameters
Discofunk007 7 months ago
@Discofunk007 You can now use annotations provided by JSR-330, such as javax.inject.Inject. If you don't want to do that, you can always fall back on writing a @Provides method for constructors that you want to inject, but that don't aren't annotated with @Inject. For example, @Provides TweetClient provideTwitterClient(Tweeter tweeter, Shortener shortener) { return new TweetClient(tweeter, shortener); }
tomfitzhenry 4 months ago
At around 7th minute Jesse says if you compile a module you have to compile everything that it depends on?!!! it's not true. Test for yourself if you don't believe me. Define a class and inside one of the methods call another class that you've defined compile it. Then see the time of creation of the class files. Then go back and change the dependent class and compile again. It will still work without needing to compile the other class again. IDEs also keep track of these dependencies
eelakh 1 year ago
@eelakh
True, but javac don't so it depend on which compiler you use.
mtilsted 1 year ago
Hollywood principle "don't call us, we'll call you."
Bollywood principle "call us, we won't call you. No balance dude!"
Haha... No offense, just a joke!
utsavgupta 1 year ago
Comment removed
subway394 1 year ago
guice-servlet module, seems to be like going back. we moved the configuration from servlet code to XML in early 2000 and now we are going back..
arsathish 2 years ago
gwt juniorsatanas muito bom !
juniorsatanas 2 years ago
This comment has received too many negative votes show
Why he didn't use "else" in the first code? =)
tivrfoa 2 years ago
Nope, he couldnt use else in this method, because text local variable can be changed in the first if block of code (see: text = shortener.shorten(text);).
AFromPoland 2 years ago
It would still have been a direct dependency, every class that goes into an if block has to be imported (i.e. loaded and initiated).
eragon841 2 years ago
Great video... Made me try my first GUICE servlet with Google App Engine. Looking forward to use GUICE more... thanks guys
iqbalyusuf 2 years ago
I love Guice but don't quite like the infomercial style of making every other way look so ugly at the beginning of the video.
muralive 2 years ago
But unfortunatelly it is, at least, painfull
awreganff 2 years ago
great vid!
FlockerSTS 2 years ago
Good presentation ! thanks
rajeshvasudevana 2 years ago