Grails 设计思想

在grails把所有的逻辑都放入controller中,一个Domian类拥有Save,Delete,find..等等各种方法。
在原来的java开发中,典型的SSH,这些操作都应该是使用service,dao来完成的。

虽然表面上它简化了我们开发,提高了速度。

但从OO思想来看,并结合DDD,这就是一个错误。比如一个对象p.save(p),自己保存自己这本身,你不觉得有些奇快吗?

看了看Grails user 官方文档,对servic描述的非常少,开头为
The Grails team discourages the embedding of core application logic inside controllers, as it does not promote re-use and a clean separation of concerns

看来要做好grails真正开发设计,还是要花功夫的。
学下ddd吧。
明天继续service翻译。

你可能感兴趣的:(DAO,ssh,OO,grails)