本文介绍了Comaprison的Liferay ServiceBuilder到其他代码生成工具,如AndroMDA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始深入liferay 6.x ServiceBuilder框架,真的很喜欢它的代码生成方法。一个简单的service.xml文件可以生成即时使用强大的服务,甚至不需要编写单行代码。



我也尝试过调查AndroMDA,它可以从UML模型生成类似的服务,听起来更有趣,因为它将直接链接我的业务模型,而不需要学习service.xml中的新xml配置(在liferay ServiceBuilder的情况下)



现在我正在决定使用哪个工具。根据您对这些工具的使用体验请让我知道使用这个图书库的优缺点是什么。



我有兴趣了解这些方面,您自己的想法


  1. 这是更好的保持我的发展更有成效的长期。

  2. 我使用ServiceBuilder将能够使用外部门户env服务(让我们说从非门户应用服务器运行相同的服务。

  3. UML驱动的方法总是好的或有一些实用的

  4. 你知道任何其他代码生成库比liferay 6.x开发的这两个更好吗?我也检查了这些SO线程

  5. p>



解决方案

已经经历过Servicebuilder(我使用liferay 5.2.3):


  1. 无法使用ORM框架。没有办法在对象之间生成
    关系。因为这个我有效地工作
    只是对象映射。

  2. 不能使用面向对象的基本事物,例如继承域或服务

  3. 很难写单元测试用例

  4. 我还是不明白需要复杂的域结构

  5. 我觉得它生成的代码可以使用一个IDE

但是它确实有它自己的好处,如Egar说,它是专门为Liferay。因此,它可以快速生成liferay所需的一切。我听说在最新版本的liferay少数上述问题是固定的。



总体而言,这取决于您的要求。如果你需要更多的控制你的ORM层,并且你有复杂的业务逻辑,需要相当多的单元测试,去正常的Spring服务,可以作为webservices或REST服务暴露给你的portlet。



否则服务构建器也适用于简单的portlet。其他方法可以使用两者。所有复杂的服务作为一个单独的项目和简单的服务生成器。


I started digging into the liferay 6.x ServiceBuilder framework and really liked its code generation approach. A simple service.xml file can generate ready to use powerful services without even writing a single line of code.

I also tried looking into AndroMDA which can generate similar services from the UML model, which sounds even more interesting since it will link my business model directly without me needing to learn a new xml config for service.xml (in case of liferay ServiceBuilder)

now I am in the process of deciding which tool should I use. Based on your experience with any of these tools Please let me know what are Pros/Cons of using any of this library,

I am interested to know these aspects, along with your own thoughts

  1. Which is better to keep my development more productive in long term.
  2. If I use ServiceBuilder will I be able to use the services outside portal env (lets say running same service from a non-portal app server.
  3. Is UML driven approach always good or there are some practical cons/challenges of it.
  4. Do you know of any other code generation library which is better than these two for liferay 6.x development? I also checked these SO Threads

解决方案

Following few problems I have experienced with Servicebuilder (I am using liferay 5.2.3) :

  1. Not able to make use ORM framework. There is no way to generaterelations among objects. Because of this I am effectively workingjust object mapper. It is not generating onetomany kind of relations
  2. Can not use basic object oriented things like inheritance with domain or services
  3. It is quite hard to write unit test cases
  4. I still didn't understand what is the need of complex domain structure
  5. I feel the code it is generating can be quickly written using an IDE

But definitely it has its own benefits like Egar said, it is specifically made for Liferay. So it can quickly generate everything that is needed for liferay. I heard in latest versions of liferay few of above problems are fixed.

Overall it depends on your requirement. If you need more control over your ORM layer and you have complex business logic which needs quite a lot of unit testing, go for normal spring services which can be exposed as webservices or REST services to your portlets.

Otherwise service builder is also good for simple portlets. Other approach could be using both. All complex services as a separate project and simple ones with service builder.

这篇关于Comaprison的Liferay ServiceBuilder到其他代码生成工具,如AndroMDA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 09:37