Groovy is a Java-based "next generation" programming language designed to improve Java while adding popular features from Smalltalk, Python and Ruby. Groovy syntax is a super-set of Java which allows Java developers to begin coding in Groovy as they learn it. Groovy is fully object-orientated, dynamic and seamlessly integrates with Java. Market-wise, the success of Groovy is anybody's guess. Main competitors are Ruby, Scala and Closure.
Questions tagged [groovy]
37 questions
76
votes
3 answers
What is the difference between a Future and a Promise?
What is the difference between a Future and a promise? (In Akka and Gpars.)
They look the same to me as both block and return the value of the future when get is called and a promise is to get the result of a future.

Suminda Sirinath S. Dharmasena
- 935
- 1
- 7
- 9
30
votes
5 answers
Is Groovy going away?
I am sure this question has been asked many times. However, I like to ask it again with the intention of what is the future of these languages.
I was first introduced to Groovy and really liked it. I felt the syntax was simpler and it was much…

Amir Raminfar
- 402
- 1
- 4
- 8
29
votes
2 answers
When to use def in Groovy?
I have been developing in Groovy for a little while now and I'm wondering how often I should be using the dynamic casting def? A co-worker of mine believes we should use it always as it helps Groovy in some way I don't understand.
Currently, when…

PJT
- 393
- 1
- 3
- 6
26
votes
3 answers
When to write an explicit return statement in Groovy?
At the moment I am working on a Groovy/Grails project (which I'm quite new in) and I wonder whether it is good practice to omit the return keyword in Groovy methods. As far as I know you have to explicitly insert the keyword i.e. for guard clauses,…

Roland Schneider
- 843
- 1
- 7
- 10
24
votes
4 answers
Make methods that do not depend on instance fields, static?
Recently I started programming in Groovy for a integration testing framework, for a Java project. I use Intellij IDEA with Groovy plug-in and I am surprised to see as a warning for all the methods that are non-static and do not depend on any…

Random42
- 10,370
- 10
- 48
- 65
15
votes
4 answers
Does groovy call partial application 'currying'?
Groovy has a concept that it calls 'currying'. Here's an example from their wiki:
def divide = { a, b -> a / b }
def halver = divide.rcurry(2)
assert halver(8) == 4
My understanding of what's going on here is that the right hand argument of divide…

Richard Warburton
- 1,042
- 2
- 9
- 14
15
votes
1 answer
Does Groovy follow Tennent's Correspondence Principle?
Here's an interesting discussion of Tennent's Correspondence Principle, and a brief description from Neal Gafter:
The principle dictates that an expression or statement, when wrapped in a closure and then immediately invoked, ought to have the same…

Armand
- 6,508
- 4
- 37
- 53
13
votes
1 answer
What does 'syntax vinegar' mean
I was reading through Groovy in Action, Second Edition and on a footnote, I found the following text
Java pours “syntax vinegar” over such a construct to discourage programmers from using it.
What does the term syntax vinegar means here?
I have…

isuru-buddhika
- 289
- 3
- 9
12
votes
5 answers
Pitfalls in the Grails Framework
What are some of the biggest issues/pitfalls with using the Grails framework? I'm learning the framework now, and I really like it, but I need to know what major issues I may encounter when using it and how to avoid them.

jmq
- 6,048
- 5
- 28
- 39
12
votes
1 answer
Traits, Inheritance and Interfaces in Groovy, when to use them?
I'm learning groovy and I've just learned about the new feature added in 2.3, which is the addition of Traits. Now to me it seems like Traits allow you to do basically everything a super-class and an Interface can do.
Does the addition of Traits…

Ryan Stull
- 958
- 1
- 9
- 15
9
votes
5 answers
Is there a clear leader amongst JVM-based languages?
What is the current status of these projects, and has any one (or two) emerged as a clear leader?
To demonstrate my motives for asking this question, cast your mind back several years. Prototype and jQuery were going head-to-head with other players…

rinogo
- 217
- 2
- 6
9
votes
4 answers
What's special about currying or partial application?
I've been reading articles on Functional programming everyday and been trying to apply some practices as much as possible. But I don't understand what is unique in currying or partial application.
Take this Groovy code as an example:
def mul = { a,…

Vigneshwaran
- 759
- 6
- 16
8
votes
3 answers
Jython and JRuby vs. Groovy (and Java)
I am very interested in Python for programming on the JVM, and I've worked in Java and Ruby (not JRuby) a lot, and to a certain extent in Groovy.
What are the limits to the Java-Jython and Java-JRuby integration right now? What about Groovy: are…

Dan Rosenstark
- 2,344
- 1
- 20
- 20
7
votes
2 answers
How difficult would it be to migrate a Struts/JSP application to Groovy?
I have taken over development of a JSP/Struts application. Right now it's a bit of a mess, and I'm finding the JSP pages with Struts tags to be insanely verbose. Has anyone migrated a Struts application to Groovy/Grails? Can it be done…

kevin cline
- 33,608
- 3
- 71
- 142
4
votes
1 answer
Converting cron schedule to time intervals
I have, on the server, many jobs defined by users and some of those jobs are scheduled using cron expressions. I need to check (I can execute Groovy/Java on the server) if those jobs take longer than they are scheduled (I mean job is taking 10…

Erki M.
- 141
- 1
- 5