Monday, September 27, 2010

DI, JSR-330, Google/Guice

On JSR 330: Dependency Injection for Java

interesting introduction to Guice:

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

I like Guice, it's very specific and focused. Unfortunately it seems it's not undergoing a lot of development, version 2.0 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  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 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: