In association with heise online

Small, fast, and crystal clear

Guice shows its performance advantages over Spring when it comes to generating requested objects, both at the start of the application and at runtime. Guice gets its lead in creating objects from Java 5's concurrency capabilities (although the balance is likely to change on the arrival of Spring 3, which will be based completely on Java 5). It also skips the generation of the proxy properties that Spring uses, but how relevant that is in practice depends on the nature of the application.

Choosing between tools has to take account not only of their technical characteristics and range of functions, but also of such aspects as complexity. Google says Guice has clear advantages over Spring in simplicity, clarity, maintainability, ease of learning, and performance.

Comparisons between the two frameworks have generated a lot of excited discussion among programmers. Ultimately, however, it doesn't come down to an either/or decision, because although both are DI containers, each has a different focus. Guice leaves a smaller footprint behind, while Spring is presented as a comprehensive and powerful solution. A large part of Spring's XML complexity moreover results from functions outside of DI. Since Guice doesn't cover these areas, there is no genuine rivalry between them. Even coexistence between the two frameworks can be imagined, because Guice permits links to Spring Beans.

The plan for Guice 2 – ("intended for release in January 2009") – contains a whole raft of extensions, including construction listeners and an Introspection API. Listeners offer entry points at which custom logic can be linked in during object generation. The API extension is supposed to disclose the internals of the injector object and permit full access to the dependency graph. That would offer a foothold for visualisation tools, for example. Furthermore, the roadmap specifies provider methods that it claims to simplify the design of module classes. Custom providers could thus carry out more flexible binding, perhaps being effective only in a given scope.

Next: Not a passing fancy

Print Version | Permalink: http://h-online.com/-746531
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit