Compare JRuby, Groovy and Python
2009-03-03 22:35
351 查看
If I were to rate JRuby, Jython, and Groovy in terms of integration with existing Java code, I’d have to say that Groovy is the most robust, JRuby is the next strongest, and Jython lags behind. The recent Sun hires may turn Jython around but my guess is that Jython is at least six months to a year away from being used in serious production deployments.
Jython is similar to Python. And Python is a pretty different language from most others. The sticking point for many people is the way you write the code – space actually matters. White space, ignored by almost all other programming languages, is significant in Python. Most people either love it or hate it, though I’m in the middle. It’s a characteristic that is unique to Python and that Jython picks up. In addition, there’s a bit of an impedance mismatch between Java and Python. The conversion process around basic collection classes and other primitives when integrating with Java seems to be a bit clunky. It’s just not completely smooth – it gets in the way a little more than it should.
In JRuby, conversion is considerably easier. You can convert back and forth very nicely, so you have little to fear. In my view, Groovy is even easier to use than JRuby and works more seamlessly with Java. I sometimes joke that Groovy is simply a “fancy Java.” This is because Groovy is written in Java, uses all the same classes, and has no gaps. All of these features are readily apparent in the language.
Essentially, there’s no simple answer as to which one is the “best” language. If I were to write some quick scripting task that needs to use Java in a non-trivial fashion, I’d almost certainly go with Groovy. If I were to use a lot of native facilities, such as manipulating files or directories, and needed to get a little down and dirty with the details of operating system–specific facilities, I’d go with JRuby. This is because Ruby has a deeper linkage to the platform you’re on, whereas Groovy only has Java-level tie-ins.
JRuby has recently done a lot to overcome most of its problems integrating with Java. It’s not quite 100 percent there yet but I have no doubt the core developers will be able to smooth out the process this year. I think they can get it to the point where it’s almost as good as Groovy almost all the time, but I don’t think it will ever be able to attain the same level of seamlessness as Groovy.
Jython is similar to Python. And Python is a pretty different language from most others. The sticking point for many people is the way you write the code – space actually matters. White space, ignored by almost all other programming languages, is significant in Python. Most people either love it or hate it, though I’m in the middle. It’s a characteristic that is unique to Python and that Jython picks up. In addition, there’s a bit of an impedance mismatch between Java and Python. The conversion process around basic collection classes and other primitives when integrating with Java seems to be a bit clunky. It’s just not completely smooth – it gets in the way a little more than it should.
In JRuby, conversion is considerably easier. You can convert back and forth very nicely, so you have little to fear. In my view, Groovy is even easier to use than JRuby and works more seamlessly with Java. I sometimes joke that Groovy is simply a “fancy Java.” This is because Groovy is written in Java, uses all the same classes, and has no gaps. All of these features are readily apparent in the language.
Essentially, there’s no simple answer as to which one is the “best” language. If I were to write some quick scripting task that needs to use Java in a non-trivial fashion, I’d almost certainly go with Groovy. If I were to use a lot of native facilities, such as manipulating files or directories, and needed to get a little down and dirty with the details of operating system–specific facilities, I’d go with JRuby. This is because Ruby has a deeper linkage to the platform you’re on, whereas Groovy only has Java-level tie-ins.
JRuby has recently done a lot to overcome most of its problems integrating with Java. It’s not quite 100 percent there yet but I have no doubt the core developers will be able to smooth out the process this year. I think they can get it to the point where it’s almost as good as Groovy almost all the time, but I don’t think it will ever be able to attain the same level of seamlessness as Groovy.
相关文章推荐
- [leetcode]Best Time to Buy and Sell Stock II @ Python
- Configure PHP and Django (Python) to run on the same Apache site.
- Decorators and Functional Python
- python中的cm()len() list() and tuple()以及一些内建函数
- [比较编程]Sorting in Ruby and Python
- learning python from codecademy: 2.Strings and Console Output
- Groovy 更新到 2.0.8 and 2.1.3
- Python 中 and 和 or 的使用
- python mysql data change and query
- 8.1. datetime — Basic date and time types — Python v2.7.3 documentation
- python3----转换大小写(upper lower capitalize and title)
- Python: import Module and Class
- Django on IronPython and Windows
- Probability And Statistics In Python: Linear Regression
- 【转载】python 中的 and、or、and-or
- 【转载】python 中的 and、or、and-or
- 制作一个python-docker image and run a container!
- Leetcode_binary-tree-zigzag-level-order-traversal (updated c++ and python version)
- python 时间模块小结 time and datetime
- Hadoop, Python, and NoSQL lead the pack for big data jobs