Groovy or Ruby ?
Monday, January 21st, 2008Since my presentation on Ruby (march 2007), Groovy has gained a lot of improvements :
- support for open classes (in Groovy 1.1)
- better support of DSL with method call without parenthesis (in Groovy 1.5)
Thus, Groovy is catching most features I like from Ruby. Nevertheless, I still prefer Ruby and not only for its more elegant syntax …
In his article Groovy or JRuby, Martin Fowler wrote :
“If you are only interested in running on the JVM, then Groovy could well be the easier choice. You are working directly with Java’s library and object model, and the syntax requires less getting used to. A strong reason to prefer Ruby is the fact that it lives in multiple implementations. Ruby is a tool you can use in a lot of other places.”
I completely agree. Groovy’s strength is also its weakness : the JVM is the only target platform.
The JVM is a great platform but the .NET platform is also a great one. If you need a seamless integration with the .NET framework, you will get it with Ruby.NET or IronRuby in a near future.
Also, Ruby’s official implementations (ruby 1.8 and ruby 1.9) allow to reuse native libraries through the C extension feature. Thus, there are a lot of interesting libraries in the Ruby “native world” like :
- cross-platform GUI toolkits with native widgets : Shoes (a lightweight toolkit with a Web approach), wxRuby (a more general purpose toolkit), …
- SQLite/Ruby, a wrapping of SQLite, the widely used embedded SQL database engine.
- …
Of course, such libraries can be written or wrapped in Java (via JNI) and be usable in Groovy (as in JRuby). The Eclipse SWT is an example of a Java GUI toolkit with native widgets.
But basically, you have more possibilities of integrating/reusing existing software with Ruby.
Ruby 1.9.0 introduces also new features but this is another story …