Guice Talk followup
I gave my Guice presentation tonight. The best part of the talk for me is that a lot of people chimed in with comments and questions, which is just the way I like it. Thanks to everyone for attending and for generating some good discussion. My talk was comprised mostly of code samples, the presentation materials will soon be available on the JUG knowledge base.
It was great to see some old compadres (Greg, Rasesh, Jeff C and Dennis) as well as introduce myself to some familiar faces in the St. Louis Java community (Michael, Mark, Jeff G, Weiqi, Kyle).
The differences between Guice and Spring were definitely a frequent line of questions and comments. Some open questions and comments that came up related to this are:
- Is it ever preferable to have your application’s configuration truly outside of the source code (a la Spring xml)? Is there value in reconfiguring the app without rebuilding, or is that just a pipe dream? Is external configuration desirable so that non-developers can reconfigure a system, or is that fraught with peril?
- What would be a reason to integrate Guice into an existing code base which uses Spring, especially if you are already leveraging Spring 2.5’s annotation-based dependency injection? I conceded there may be no reason. Kyle Cordes pointed out that in a pristine, pie-in-the-sky world this may be true, but so often in the real world there are large clunky heterogeneous revenue-generating apps and components which need integrating, and you may be in a situation where you have no choice but to integrate Guice with Spring. In that department, Guice scores points for having integration with Spring built in.
- Is there a Guice parallel to Spring’s named instances? That is, in Spring you can configure beans which are named multiple instances of a single concrete type, and said beans can be injected. Jeff C suggested that a Guice Provider might supply that behavior. Kyle pointed out that, by Guice’s very nature you may not need to declaratively configure named instances because Guice entirely operates as Java, and you should be able to just programmatically get or create whatever instances you want. It’s definitely a different mindset than Spring.
Weiqi urged some of us to read the Guice source code, particularly to be impressed by some clever use of generics. I plan to read a little of it right now.
This just in - Weiqi has already written a writeup of my talk on his own blog. Thanks Weiqi, I’m flattered!
Leave a comment