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, ...

learn more… | top users | synonyms

2
votes
2answers
61 views

Method for all objects for checking conditions which also includes method chaining and avoiding variables

(I am currently using groovy but it should apply to most OO languages so I also put the langauge-agnostic tag) I try to program in a function style which also includes method chaining and avoiding ...
2
votes
1answer
280 views

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 ...
3
votes
1answer
102 views

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 ...
3
votes
2answers
300 views

Speed difference between VM-based and compiled code [closed]

Not so long ago I was told by a senior academic that, these days, VM-based code could run nearly as fast as compiled code, but my own experience is that compiled code runs several orders of time ...
2
votes
1answer
145 views

Moving business logic from services to classes?

I have a Grails application with a number of services that are starting to get very large. The flow in the majority of my service methods is Database read (Returns DBCursor from MongoDB) Iterate ...
1
vote
1answer
262 views

Best practice for comments above methods in a grails application?

I'm writing a grails application and am not sure what the best practice is with regard to comments outside of method blocks. I've done a bit of research and there seems to be conflicting views on how ...
7
votes
4answers
1k views

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 ...
16
votes
5answers
5k views

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 ...
3
votes
1answer
169 views

What's the computational complexity of the Groovy unique() method?

Question 1 What's the computational complexity of the Groovy unique() method? Question 2 How could I have figured it out by myself? The unique() method is defined in the class DefaultGroovyMethods. ...
3
votes
2answers
1k views

Testing Java as Groovy

We're looking into improving our testing process for some of our applications, and the idea that's been put forward it to write unit tests in Groovy and automatically run them with Maven. The first ...
8
votes
4answers
925 views

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. ...
2
votes
2answers
271 views

New insights I can learn from the Groovy language

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, ...
13
votes
4answers
837 views

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 ...
4
votes
3answers
2k views

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 ...
4
votes
3answers
161 views

What class structure allows for a base class and mix/match of subclasses? (Similar to Users w/ roles)

I have a set of base characteristics, and then a number of sub-types. Each instance must be one of the sub-types, but can be multiple sub-types at once. The sub-types of each thing can change. In ...
0
votes
1answer
776 views

What's the best practice for rendering a different GSP template based on the type of object in a collection?

Let's say I have a collection that is setup in my controller, named "things." In this collection is a heterogeneous assortment of objects. Let's say some are of type "Thing" and some others are of ...
-1
votes
1answer
832 views

Pros and cons of using Grails compared to pure Groovy

Say, you (by you I mean an abstract guy, any guy in your team) have experience of writing and building java web apps, know about filters, servlet mappings and so on, and so on. Also, let us assume ...
15
votes
1answer
362 views

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 ...
26
votes
5answers
14k views

Is Groovy going away? [closed]

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 ...
4
votes
4answers
5k views

Learning Groovy vs learning Python, Ruby or Perl to get some insight on dynamic languages programming

I would like to explore programming in dynamic languages, and I found that Groovy would be really easy to learn because it is heavily based on Java. won't I miss anything important regarding dynamic ...
6
votes
2answers
2k views

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 ...
9
votes
5answers
3k views

Is there a clear leader amongst JVM-based languages? [closed]

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 ...
12
votes
5answers
895 views

Pitfalls in the Grails Framework [closed]

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 ...
1
vote
3answers
3k views

Advantages of Scala vs. Groovy with JAVA EE 6 Applications

Please let me first emphasize that I am not looking for flame wars. I just want advice from people who have real experiences. I started learning JAVA EE 6 as real newbie and am having a difficult ...
1
vote
1answer
279 views

Groovy/Grails course content

Some Java developers have asked if I could give them a 2-day primer on Grails development. I'm assuming they're familiar with: Java language and libraries Java web development, e.g. Servlets, JSPs ...
19
votes
14answers
9k views

Java devs: why not use Groovy? [closed]

OK, so there are quite a few people using Java these days. But as the language nears two decades of age, it isn't exactly the coolest option out there. Many of us are excited about dynamic languages ...
5
votes
3answers
3k views

Jython and JRuby vs. Groovy (and Java) [closed]

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 ...