Recently, as I search far and wide about using a language that is functionally programmable like R at the same time compatible with Java so that systems can be built on top it, I came across groovy. It is unlike python which is widely used for analytics since it is written in java. There are many java apis that it uses at the same time, it extends a lot of Java functionalities so that the language is much flexible.
Below are several advantages of Groovy that lead me to investigate the language even more. I have to say that the wealth of implementations of ml algorithms and scientific apis that are available in python is great. But, groovy is a good breath of fresh air in java land. Using it in conjunction with python can be extremely powerful.
Advantages of Groovy
- Properties – Groovy eliminates the need for writing getter() and setter() methods. It significantly reduces development time with syntax that is close to perl and python.
- Closures – Closures are method pointers that can be passed to other methods. Your methods can not only take multiple data structures as arguments, but now it can take methods. The implementation is much more syntactically readable than python.
- Metaprogramming – There’s a lot of extension in groovy that enables much easier ways to look back into your objects and methods.
- Multi-line strings – I love this feature in python, in groovy it is the same syntax.
- Mixins/Categories – Objects can be decorated with new methods. It does not matter if they are final. I do not like inheritance of interfaces in java so this is a great feature.
- Additional Operators – There are operators such as ?. that takes care of the nullpointerexception etc..
If you want to find out more about groovy: the groovy website has great documentation.