Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I realize that, for a programmer coming from the Java world, Groovy contains a lot of new ideas and cool tricks.

My situation is different, as I am learning Groovy coming from a dynamic background, mainly Python and Javascript. When learning a new language, I find that it helps me if I know beforehand which features are more or less old acquaintances under a new syntax and which ones are really new, so that I can concentrate on the latter. So I would like to know which traits distinguish Groovy among the dynamic languages.

What are the ideas and insights that a programmer well-versed in dynamic languages should pay attention to when learning Groovy?

share|improve this question
    
I just received a downvote and a vote to close. Mind explaining why? The question seems fine to me, but I can improve it if it violates some rules. –  Andrea Jun 30 '12 at 16:29
    
you probably received them from power hungry adolescents who didn't actually read the question, don't know what Groovy is, and assumed based on the title that the question is a troll question. I would fix the title if you want to avoid this. –  David Cowden Jun 30 '12 at 17:33
    
@Andrea I suggest re-writing your question with a title similar (but shorter) to your last sentence. It would make what you're actually asking more clear. –  Andres F. Jun 30 '12 at 17:43
3  
Groovy new ideas: LSD 2.0? –  Thomas Eding Jun 30 '12 at 18:02
    
We are now at 3 vote to close and still no indication whatsoever of what makes this a bad question :-( –  Andrea Jun 30 '12 at 23:34

2 Answers 2

up vote 4 down vote accepted

Here is an interesting comparison of Javascript and Groovy.

As far as specific features, coming from a dynamic background, you will be familiar with:

  • Script-style source execution
  • Dynamic Typing
  • Closures
  • Operator Overloading
  • Native syntax for Dictionaries
  • Regular Expressions

However, you man not have seen:

  • Safe dereference operator: potentiallyNullVariable?.methodOrField[()]
  • Native support for markup languages via inline DOM syntax
  • Features of Aspect Oriented Programming (although you may have seen that with JavaScript and Python). Take a look at SpringSource.

A full list can be found in the features section of the Wikipedia article.

All in all, Groovy is simply another dynamic language on top of the Java VM rather than its own native interpreter. However, I would suggest taking a look at Scala as Groovy's creator seems to favor it as the next Java successor (and not actually Groovy):

I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy...

share|improve this answer
    
Thank you. I want to investigate Scala as well, but I have to learn Groovy since it is used where I am going to work. –  Andrea Jun 30 '12 at 18:16

I don't think there's much more to Groovy than to Python. The main differentiator is that it runs on the JVM, so that's more about the platform than about the language itself.

Things that would come to mind without over-thinking things too much are:

  • a huge list of available libraries and frameworks,
  • a large choice of build systems,
  • regular improvements with JVM updates, which are usually backwards compatible (for good and bad, some would argue that the Python 3 break is beneficial and would be a welcome approach for the Java eco-system, others would stand strongly against it),
  • multi-threaded programming would be a lot easier.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.