Monday, September 27, 2010

DI, JSR-330, Google/Guice

On JSR 330: Dependency Injection for Java
http://www.jcp.org/en/jsr/detail?id=330

interesting introduction to Guice:
http://google-guice.googlecode.com/files/Guice-Google-IO-2009.pdf

Let me copy the DI motto: "push dependencies from the core to the edges"

Nice and lightweight book this one:

Google Guice: Agile Lightweight Dependency Injection Framework


http://apress.com/book/view/9781590599976

I like Guice, it's very specific and focused. Unfortunately it seems it's not undergoing a lot of development, version 2.0 http://code.google.com/p/google-guice/downloads/list was released in May 2009....
They claim it's both more compact than Spring 2.0 and definitely faster to execute.
This very accurate test http://www.javalobby.org/articles/guice-vs-spring/  seems to prove it.
Yet no test covers Spring 3.0.

I would say that, with all my sympathy to Guice, I would rather go for Spring 3.0, especially now that most of the bloody XML has gone...just as a resume-builder :o).

Actually Luciano has used Guice and he says "it's better than Spring, if you need only IoC; I would highly recommend Guice"

Here http://www.theserverside.com/feature/Comparing-Spring-vs-Google-Guice-By-Example a detailed dissertation on the topic. It favors definitely Guice over Spring. His conclusion is "Spring wires classes together by bean, whereas Guice wires classes together by type." ... implying that Guice is more typesafe and reliable, and less verbose.

No comments: