users@glassfish.java.net

Re: Can hk2:run be used to run anything meaningful?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Jan 2009 21:58:42 PST

I'm glad you asked, Richard, because now that I review my remark, I realize that it could be misleading -- especially in a context in which many people make choices "because it said so on the Internet".

I think the key elements in understanding my remark are "to me" and "looks" (i.e. now). Here are the reasons for which at this time I would rather use HK2 than iPOJO for dependency injection -- if I end up using DI at all.

1. As far as I can tell, all our team's current needs are completely covered by OSGi's BundleContext and ServiceTracker. It takes a very simple and intuitive pair of annotations like HK2's @Inject and @Extract to convince us to use DI at all.

2. While iPOJO clearly offers much more power than HK2 in terms of dependency injection, this extra power doesn't necessarily translate into more chances of success for a team that uses the framework. In fact, it can be like buying your kid a BMW M3: if you love your kid, you give him/her a 328 instead, and wait until (s)he's mature enough to keep an M3 on the road. Which is -- to return to our Java context -- until (s)he fully understands that a single try-catch-finally is not enough for safely releasing more than one resource, and that "synchronized" stands for more than mutual exclusion.

3. I don't think a high percentage of the Java-speaking population could debug whistling an imperfect piece of code that uses @Temporal(timeout=5000). I for one would probably loose my smile at some point... :-)
[Message sent by forum member 'andreijuan' (andreijuan)]

http://forums.java.net/jive/thread.jspa?messageID=326595