,

Everything you wanted to know about Groovy language


Everything you wanted to know about Groovy language.

groovy-logo-medium

1. What is Groovy language?

Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java Virtual Machine (JVM) bytecode, and interoperates with other Java code and libraries. Groovy uses a Java-like curly-bracket syntax. Most Java code is also syntactically valid Groovy. -Wikipedia

It is an agile and dynamic language for the Java Virtual Machine. It builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk. -http://groovy.codehaus.org/

Also see what is JVM –http://en.wikipedia.org/wiki/Java_virtual_machine
 
 
2. Who’s using Groovy in production?

By Guillaume Laforge
One might want to use it as an embedded business language (a Domain-Specific Language), and I’ve seen companies using Groovy for its nice DSL capabilities for that purpose. For example, Mutual of Omaha (Fortune 500 insurance company in the US) was one of the first well-known Groovy references. In that same kind of scenario, I’ve seen it being used in healthcare (National Cancer Institute) to do scientific simulations, or in the Energy sector like the French nuclear safety organism whose acronym always escapes me, or Energy Transfer. But I’ve seen many financial institutions using Groovy, like JPMorgan, MasterCard, Crédit Suisse etc.

Beyond business language, Groovy can also be used as a kind of scripting solution for offering extension points in your application. CMS, wikis, CI tools have been using Groovy for that: eXo Platform, XWiki, Jenkins. Another interesting example of that usage scenario is NetFlix who use Groovy to offer various levels of filtering and such through Groovy scripts. LinkedIn use Groovy also in their “Glu” open source deployment & monitoring automation platform. Oracle’s fusion middleware is using Groovy scripts in its business component suite. The European Patent Office filters, enhances, analyze multinational streams of patents with Groovy scripts. The Internet of Things also sees some nice scenarios for customizing and controlling elements of the mesh with Groovy scripts; have a look at SmartThings and Carriots who both use Groovy.

Speaking of Netflix again, they also built a cloud management platform (called Asgard) built on Groovy and Grails. Which brings me to this other usage pattern which is companies using Groovy through a framework built atop Groovy, like Grails, or Gradle. Netflix, LinkedIn, BSkyB’s Sky portals, Vodafone’s music site, Walmart’s MP3 website, SNCF (the French railways), M6 (a TV broadcasting company) and many more I can’t remember. Still about tools / frameworks powered by Groovy, I could also mention Google’s Android new build system which is using Gradle, a build automation solution using Groovy as its language.

List of companies using Grails/Groovy http://grailstartups.com/
 
 
3. Is developing in Groovy/Grails faster than in Java/Spring?

By Ashutosh Saxena
Of course. In fact, it is faster for people who are not familiar with Java, but with other languages like Ruby,Python, or Scala, since Groovy’s syntax mirrors theirs. It is also loosely typed like Javascript. For someone well-versed with Java, there is some unlearning required, but the best part for Java developers is that all Java code is valid Groovy code too.

Having said that, development in Groovy/Grails is faster because it relies on the convention over configuration paradigm, thereby removing the need for updating configuration files anytime a new class/action is added. Also, you will never have to restart your web server while developing in Groovy/Grails as all code is hot deployed by default, saving a lot of developer time.

For anyone well-versed in the basic programming concepts and at least one high-level programming language (I’ll include JavaScript as a first class high-level language), picking up Groovy and Grails should not take more than 3 days.
 
 
4. What are some essential developer tools to use in groovy?

By Guillaume Laforge
As you pointed out, once you’ve installed Groovy, you’ll need to use a good IDE if you want to develop complex and large applications. For that purpose, Eclipse (Groovy/Grails Tool Suite in particular) and Intellij IDEA are currently the best ones. NetBeans is working on updating its Groovy support as well, so you can keep an eye on it.

Then, for building your applications, Gradle is fast becoming the best choice for automating all the build, test, packaging and delivery aspects of your project. To ensure the quality of your code, track various useful metrics, I’d encourage you to have a look at the CodeNarc project, which offers Checkstyle / PMD / Findbugs capabilities, specifically geared towards your Groovy code base.

For testing purpose, Spock is an awesome testing framework, built on top of JUnit (so it integrates seamlessly with your build too of choice, and runs great from within the IDE as well). Spock lets you code your test in a BDD style (Behavior-Driven Development), proposes some great explicit assertions, mocking capabilities, and much more.
 
 
5. How difficult is it to learn groovy without knowing java?

By Jett Gamboa
One of the first languages I learned was C and since then I have not had the difficulty in learning other languages particularly the C-based ones such C# and Java. When I learned Groovy, I found it very convenient as it made code less verbose and very intuitive compared to Java. I don’t think you’d have any problems jumping straight into Groovy if you have a solid grasp of the fundamentals (loops, conditionals, … ). Since you mentioned that you’re also good at C++, the object-oriented part of it shouldn’t be an issue as well. I think you’ll also love Groovy – data structures you had to “manually manage” in C are already available and are easy to use. To add to this you’d have all the libraries available to Java at your disposal.
 
 
6. Useful links
Killer features of Groovy 2.0
Intro to Groovy
Groovy questions
Groovy Tutorials
Java to Groovy in a few steps
Books and tutorials for Groovy
 
 
7. Video Tutorial

Source: Quora.com, Wikipedia.com and Google

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.