论坛首页 Java版

Guice目前来说还只是个玩具

浏览 9259 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2008-03-13 关键字: guice

不可否认Guice是一个设计精巧的IoC容器,速度也很快,但是这个容器连最基本的对象生命周期管理都没有,也就是要提供JSR-250里面javax.annotation.PostConstruct和PreDestroy的功能,有人提出用无参数的@Inject方法来模拟init,这样明显是对Annotation的滥用,用构造参数注入然后在构造方法里面做初始化,这虽然是一种解决方法,但是有的情况下对象可能需要reinitialize,这样还是需要把初始化单独做为一个方法,用finalize方法来做destroy更不可取,没法控制什么时候执行.这个问题去年三月就有人提出来了到现在还没有解决,Guice的开发者还是不够活跃,这里这么多人捧Guice,不知道有多少人正式用在项目中.

 

   
最后更新时间:2008-03-22
玩具。。
有些夸张,不可否认它太轻量也太年轻了,
但人家既然得奖了,应该有发展的空间。
   
2 请登录后投票
最后更新时间:2008-03-22
估计跟guice的信仰有关。

摘抄一段effective java
Item 13: Favor immutability
引用

There are some classes for which immutability is impractical, including “process classes”
such as Thread and TimerTask. If a class cannot be made immutable, you should still
limit its mutability as much as possible. Reducing the number of states in which an object
can exist makes it easier to reason about the object and reduces the likelihood of errors.
Therefore constructors should create fully initialized objects with all of their invariants
established and they should not pass partially constructed instances to other methods. You
should not provide a public initialization method separate from the constructor unless there is
an extremely good reason to do so. Similarly, you should not provide a “reinitialize” method,
which enables an object to be reused as if it had been constructed with a different initial state.
A reinitialize method generally provides little if any performance benefit at the expense of
increased complexity.
   
0 请登录后投票
最后更新时间:2008-03-13
neuzhujf 写道
玩具。。
有些夸张,不可否认它太轻量也太年轻了,
但人家既然得奖了,应该有发展的空间。


加了定语"目前",是有些夸张为了吸引一下眼球
   
0 请登录后投票
最后更新时间:2008-03-13
sorphi 写道
估计跟guice的信仰有关。

摘抄一段effective java
Item 13: Favor immutability
引用

There are some classes for which immutability is impractical, including “process classes”
such as Thread and TimerTask. If a class cannot be made immutable, you should still
limit its mutability as much as possible. Reducing the number of states in which an object
can exist makes it easier to reason about the object and reduces the likelihood of errors.
Therefore constructors should create fully initialized objects with all of their invariants
established and they should not pass partially constructed instances to other methods. You
should not provide a public initialization method separate from the constructor unless there is
an extremely good reason to do so. Similarly, you should not provide a “reinitialize” method,
which enables an object to be reused as if it had been constructed with a different initial state.
A reinitialize method generally provides little if any performance benefit at the expense of
increased complexity.


这个只是针对immutable对象的,Guice的开发者已经接收了这个需求.
   
0 请登录后投票
最后更新时间:2008-03-13
不可否认的,Guice跟Spring有一场大战。
Guice的介绍很吸引人,期望能尽快稳定地应用到实际开发中。
   
0 请登录后投票
最后更新时间:2008-03-13
观望中,其实如果Guice是跟Spring在技术方向上一致的咚咚,应该拿它跟EJB3比比才对
   
0 请登录后投票
最后更新时间:2008-03-14
Guice不是08年的jolt framework的大奖吗?

楼主说它是玩具,呵呵,太过了。你写个玩具出来试试。

我承认我对Guice不了解,但是毕竟是google出的东西,好评不断,jolt也给了很高的评价。楼主不喜欢就算了,写这么个标题,只能说明你的心胸不够宽广,太不能接受不同意见了。
   
0 请登录后投票
最后更新时间:2008-03-14
skydream 写道
Guice不是08年的jolt framework的大奖吗?

楼主说它是玩具,呵呵,太过了。你写个玩具出来试试。

我承认我对Guice不了解,但是毕竟是google出的东西,好评不断,jolt也给了很高的评价。楼主不喜欢就算了,写这么个标题,只能说明你的心胸不够宽广,太不能接受不同意见了。

你错了,我也看好guice的,只是认为目前1.0版本功能还是太弱了只提供了基本的IoC和AOP功能,还不能够用于正式项目开发,我想知道的是guice既然得到这么多好评,但是有多少人拿它来开发项目,有的话请出来谈谈经验
   
0 请登录后投票
最后更新时间:2008-03-18
java领域同类的东西太多,而不是太少,大量的精力都花在选择哪个框架。
搞不好,几年之后,guice也和现在spring一样臃肿不堪。
   
0 请登录后投票
论坛首页 Java版

跳转论坛:
JavaEye推荐