jRuby on Rails vs Grails

Arm*_*and 10 grails ruby-on-rails jruby jrubyonrails

我正在寻找开发一个绿地web应用程序,它将重用许多Java组件.对我来说,显而易见的选择是Grails或jRuby on Rails,但我很难找到两者的客观比较.有没有明确的理由选择一个关于另一个:

  1. 易于与现有Java组件(在持久域之外)集成,例如JMS,EIP
  2. 支持功能测试框架
  3. 在一台机器上的性能
  4. 可扩展性

不是在寻找有关开发人员或社区活动的答案.


(我检查了Grails vs. Rails,它与我无关)

Nic*_*ger 20

Try both, and pick the language and environment that suits you best. It's true that the Grails stack out of the box is more suited towards Java integration, but many components are just a few lines of Ruby code away from integration with Rails. Rails 3 is a great release that doesn't require you to use ActiveRecord, in fact it would be trivial to use Hibernate for your models instead. See also DataMapper, MongoMapper and a whole host of database adapters for SQL and NoSQL databases alike.

Also, JUnit != functional testing. Instead, have a look at Cucumber + Cucumber-Rails + Capybara + Selenium for an integrated browser automation testing experience. Take a look at https://github.com/elabs/front_end_testing for an example application that demonstrates this stack.

I'll suggest that Ruby is better suited as a web integration language, and JRuby hits the sweet spot of making integration with Java easy as well as pleasing while making a wealth of non-Java libraries available to you. Don't think that Groovy automatically wins because it's "closer" to Java. Sometimes you need to step into a refreshingly different environment in order to have a new look at how to solve a problem.

Disclosure: as a member of the JRuby team my bias is evident in my answer.

  • 哇,15赞成(直到现在)?!为了什么? - 提问者指定了四个标准,可以使答案成为解决方案. - 但是,您只响应其中一个(功能测试). - 如何整合像JMS这样的Java企业技术(这是问题中的要求)?最有可能的是,从JRuby到那些距离很远. (4认同)

Eri*_*ler 5

我非常了解Grails(现在我正在研究Grails项目),但不是JRuby,所以把这看作是一个可能有偏见的观点:看看JRuby文档,看起来JRubys与Java的集成有点麻烦,因为Java在Groovy中比在Ruby中更本地化; 因此,在JRuby中,你有很多特定的Java的关键字和方法(例如java_import,java_send).简而言之,Groovy是一种专门针对Java世界的语言,而JRuby就是将Ruby放在JVM上.

Grails内置了JUnit测试.

不能说性能和可伸缩性,但考虑到与Java的良好集成,当Groovy太慢时,总是可以在Java中编写性能关键部分.


pho*_*oet 4

  • 易于与现有 Java 组件集成:

使用 groovy 更容易,因为 groovy 基本上是 java。你没有大的上下文切换

  • 支持功能测试框架

ruby 有自己的一堆测试框架,例如 rspec/shoulda/cucumber/steak 等等。因为我喜欢 ruby​​ 语法,所以我更喜欢那些

  • 单机性能

据我所知,grails在多线程方面比较好,因为rails过去并没有太关注多线程。他们目前正在追赶,所以可能会打平。

  • 可扩展性

两者都随 jvm 环境扩展。如果您有 Java 的运行基础架构,则 Grails 更容易集成。