14:30 till this point, they explain why to use DI in the first place 14:40 why Guice? 16:52 Bindings 24:15 Scopes 28:12 Defining injections 30:55 Injecting providers 32:45 Leveraging Guice 41:00 AOP 43:45 Introspection SPI 47:30 how to compose modules
@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.
Why reinventing Spring? there is nothing I saw in this video that could convince me to use Guice instead of Spring. And I'm not even talking about other Spring Projects...
My post was a while ago, i dont really remember everything i saw about guice, but with proper ide support you have type safety even in your xmls... anyway thats not an argument to switch to anything else... spring provides not only DI it gives a lot of awesome technologies to develop serious enterprize apps... i doubt that with guice you could easily use spring security or spring data or any other component...
Vachagan Balayan i guess its a matter of preference. i like guice because it has modules that you could, in theory at least :P, reuse in other apps without copy+pasting the beans.xml. however spring is more of a "kitchen sink" framework, it has way more features compared to guice. it more like a eco-system where guice is more of a lib.
@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.
I think that the point there is that the setup and teardown are boilerplate, no matter if you do it manually or using the JUnit methods. Using Guice you are supposed to not even need to setup and teardown.
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);).
one question though, when you are configuring your depencies in a module, at the end of the line/tree, your leaf dependencies will always have to be classes with no argument constructors, correct? There is no way, that you can configure juice to just inject you a class depends on a Long, for example. You would have to wrap that long in some wrap long class with a no argument constructor, or something of the sort. So, for example, if the smsTwitter need a Locale as input, that would be the end.
what stops them from creating with new TwitterFactory("mockTestSmsProviderUrl") and not dealing with ugly static methods that won't work in multi-threading environment anyway and will make them always to write a tearDown method to cleanup parameters passed via static method? (i'm talking about ruclips.net/video/hBVJbzAagfs/видео.htmlm20s example)
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!
I thought Juice was spelled with a J not G. GUICE. JUICE GONE. JUNGLE GET. JET GATHER. JUSTICE Maybe that's why my nickname is "JuiceMan" go figure, lol.
When we make discovery or invention, we should always give it a unique name, preferably a short memorable non-word, because most publications are read by machines these days. For example, "p53" is a far better gene name than "her" as the latter is likely to be filtered out by a stoplist of common words, missing out great opportunities of cancer cure discovery by machine learning. By the same token, "guice" is more googleable than "juice." Good job, Google!
14:30 till this point, they explain why to use DI in the first place
14:40 why Guice?
16:52 Bindings
24:15 Scopes
28:12 Defining injections
30:55 Injecting providers
32:45 Leveraging Guice
41:00 AOP
43:45 Introspection SPI
47:30 how to compose modules
"Wave uses guice, why aren't you". Yeah. That didn't age well.
@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.
Reinventing Spring? Nah! They are reinventing Borland JBuilder.
Why reinventing Spring? there is nothing I saw in this video that could convince me to use Guice instead of Spring. And I'm not even talking about other Spring Projects...
because guice is typesafe and spring is not?
My post was a while ago, i dont really remember everything i saw about guice, but with proper ide support you have type safety even in your xmls... anyway thats not an argument to switch to anything else... spring provides not only DI it gives a lot of awesome technologies to develop serious enterprize apps... i doubt that with guice you could easily use spring security or spring data or any other component...
Vachagan Balayan i guess its a matter of preference. i like guice because it has modules that you could, in theory at least :P, reuse in other apps without copy+pasting the beans.xml. however spring is more of a "kitchen sink" framework, it has way more features compared to guice. it more like a eco-system where guice is more of a lib.
Spring is type safe.
github.com/google/guice/wiki/SpringComparison
Another good google guice tutorial at :
ruclips.net/p/PLp0ed20U4R4jknb4xYdhx3yJn5RhWECxn
who is 2021 in?
R.I.P Bob!! :(
RIP Bob Lee. :(
@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.
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..
Why Reinventing Spring?
Why reinventing inversion of control?
@eelakh
True, but javac don't so it depend on which compiler you use.
watching this in 2020
mood
I think that the point there is that the setup and teardown are boilerplate, no matter if you do it manually or using the JUnit methods.
Using Guice you are supposed to not even need to setup and teardown.
Hey guys - what do you think the junit setup/teardown methods are for... Not saying DI isn't needed, but your unit test makes a poor argument...
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).
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
Good presentation ! thanks
Soo pretty much this is a re-write of Spring.
@Deonex What do you mean? Im noob with Spring, and I discover this... jejej.
"Google Wave uses it" loool!
"Well Google wave uses it, so why aren't you?" Shhh!
Can you share the links to the presentation. The link mentioned above doesn't work.
Sriharsha C V ;
great vid!
That's right! That is the Hollywood sign. Very good!
Sorry, forgot to mention @13:54
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);).
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
one word : WELD
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.
Why he didn't use "else" in the first code? =)
Both code blocks are intended to run.
@@jamesflames6987 my question from 13 years ago. Thank you! yes, the first if updates 'text'
one question though, when you are configuring your depencies in a module, at the end of the line/tree, your leaf dependencies will always have to be classes with no argument constructors, correct? There is no way, that you can configure juice to just inject you a class depends on a Long, for example. You would have to wrap that long in some wrap long class with a no argument constructor, or something of the sort. So, for example, if the smsTwitter need a Locale as input, that would be the end.
I thought it was shadow until I read your comment! Worst. Beard. Ever.
I used to have that kind of beard 😆
24:34
what stops them from creating with new TwitterFactory("mockTestSmsProviderUrl") and not dealing with ugly static methods that won't work in multi-threading environment anyway and will make them always to write a tearDown method to cleanup parameters passed via static method? (i'm talking about ruclips.net/video/hBVJbzAagfs/видео.htmlm20s example)
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!
I thought Juice was spelled with a J not G.
GUICE. JUICE
GONE. JUNGLE
GET. JET
GATHER. JUSTICE
Maybe that's why my nickname is "JuiceMan" go figure, lol.
When we make discovery or invention, we should always give it a unique name, preferably a short memorable non-word, because most publications are read by machines these days. For example, "p53" is a far better gene name than "her" as the latter is likely to be filtered out by a stoplist of common words, missing out great opportunities of cancer cure discovery by machine learning. By the same token, "guice" is more googleable than "juice." Good job, Google!