Tag Info

Hot answers tagged

17

I don't think Groovy is going to disappear, it is a self sustained entity now. Grails framework is built around Groovy language, which it is a good reason to stay alive. Groovy got its killer application. I'm not saying Grails is the only vital Groovy project, Gradle is also pretty good. GORM is really handy. Gant is a nice improvement over Ant. Not ...


13

IMO, the weakest part of Grails has been the lack of data model migration functionality (ala Rails ActiveRecord migrations). There were some 3rd-party plugins of varying levels of quality, but nothing official. However, I just discovered that Liquibase has been extended and turned into the database-migration plugin, and that looks promising: ...


12

None None have the market penetration necessary to declare them as a "winner" in the race (if there is one) to find a better JVM language. Checking available jobs (on careers.stackoverflow.com) as indicator of the market for people with these skills. 1 groovy job. 4 scala jobs. 21 C# jobs. 22 ruby jobs. 29 python jobs. 34 php jobs. 39 java jobs. 0 for ...


12

Here my reasons: dynamic typing: Yes, it's the reason for many to prefer groovy. but static typing has it's advantages, i.e. in readability. performance: In my experience some groovy-applications are significantly slower than java-apps. PermGenSpace: We had problems with PermGenSpace-Errors using grails-webapps on Tomcat. Maybe less an Groovy and more a ...


12

Groovy's implementation of curry does not actually curry at any point, even behind the scenes. It is essentially identical to partial application. The curry, rcurry and ncurry methods return a CurriedClosure object that holds the bound arguments. It also has a method getUncurriedArguments (misnamed—you curry functions, not arguments) which returns the ...


11

I am a java developer, the reasons I am not using Groovy are: It's dynamically typed When I search for a job on a popular recruitment webiste there are 11,000 Java jobs, and only 11 Groovy jobs.


11

Note that IDEA has this inspection for Java as well, it is called Method may be 'static', This inspection reports any methods which may safely be made static. A method may be static if it doesn't reference any of its class' non static methods and non static fields and isn't overridden in a sub class... Thing is though that for Java code, this ...


9

Groovy is the best example for a Dynamic language. It generally makes life so simple with elegant syntax. And ya, you can feel the taste of Ruby in Groovy as its been inspired by Ruby, Python and smalltalk. Many things that are done in Ruby and Python can be done in Groovy. Groovy not only for its Dynamic features but also can be used as functional language. ...


9

I'll talk about Akka/Scala, because I'm not familiar with Gpars nor with Akka/Java. In Scala 2.10, which includes the relevant part of Akka in the standard distribution, a Future is essentially a read-only reference to a yet-to-be-computed value. A Promise is a pretty much the same except that you can write to it as well. In other words, you can read from ...


8

Currying is about turning/representing a function which takes n inputs into n functions that each take 1 input. Partial application is about fixing some of the inputs to a function. The motivation for partial application is primarily that it makes it easier to write higher order function libraries. For instance the algorithms in C++ STL all largely take ...


7

A year ago there was an evaluation of Stack Overflow community sizes, and Scala got the lead, with Groovy and Clojure very close. You might use the freely available dump to make similar queries. At any rate, I don't see any clear winner at all in the JVM land. First of all, there's a big crowd that likes dynamic languages, and won't go with Scala. Then, ...


7

I'm not using Groovy because I don't see the need for it. Seeing as it is run on the JVM and I already know Java pretty well, why would I invest my time in something that is pretty much the same anyway. But I realise that I can't be a one trick pony for my whole career. That's why I have started to learn Python. When I was looking for a new language to ...


7

As well as @The Legend of 1982's comments: Groovy will continue to stick around as it's the dynamic alternative to Java with syntax that is close enough to Java to allow many developers to make the switch (or at least dabble in it). Grails is constantly in the top 2 frameworks whenever Matt Raible does his massive JVM language web framework comparison ...


6

Having done quite a bit of Groovy programming and given it a "good go" I now prefer the "pure Java" approach for the following reasons:- Debugging -- the debugger walks you through tons of internal groovy code. I know there are some options to filter this out but they are far from perfect and either don't filter out all the internal code or skip over some ...


6

But I can do the same thing (left-curry, right-curry, n-curry or partial application) by simply creating another named or anonymous function or closure that will forward the parameters to the original function (like tripler2) in most languages (even C.) And the optimizer will look at that and promptly go on to something it can understand. Currying is a ...


5

Running the integration tests were slow as the grails environment takes time to load and only a fraction of that time is required to run the test. This will increase the turn around time when you are developing code which writes to the db. The other problem has already been mentioned by Kaleb in his answer (about the data migration). I also found that ...


5

According to wikipedia, they are the same concept: In computer science, future, promise, and delay refer to constructs used for synchronizing in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown, usually because the computation of its value is yet incomplete. Some libraries may ...


4

I have no experience of JRuby nor Groovy. But Jython: Excellent integration with NetBeans. NetBeans can run Python programs with Jython almost straight out of the box, just install the "Jython Distribution" plugin and you're done. Apparently Eclipse works as well. See chapter Using Jython in an IDE in the Jython Book. Java-Jython integration is excellent. ...


4

Not quite, but almost. All the variables accessible in the outer scope are accessible in the closure, including 'this' and class data members. However, a return statement returns from the closure, not from the enclosing function. I'm not even sure that is a violation of TCP; I don't know of any C-style language where return in a closure returns from the ...


4

What you want are Interfaces. Each interface can mandate a characteristic. A class can implement multiple interfaces as it pleases: interface Foo { boolean doFoo(); } interface Bar { boolean doBar(); } class fooImpl implements Foo { boolean doFoo(){ . . . } } class barImpl implements Bar { boolean doBar(){ . . . } } class ...


4

I certain would add the return, as it makes the intention clearer to any person (including yourself) who may come and update/maintain the code later on. Otherwise it might look like a typing error. The other thing is to remember to declare functions/closures that are expected to return a void as 'void' - again to make it clearer to future maintainers what ...


4

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


4

As @jk. alluded to, currying can help make code more general. For example, suppose you had these three functions (in Haskell): > let q a b = (2 + a) * b > let r g = g 3 > let f a b = b (a 1) The function f here takes two functions as arguments, passes 1 to the first function and passes the result of the first call to the second function. If ...


4

As Lernkurve pointed out in the comments, the implementation given in Groovy's source code appears to be O(n^2). public static <T> Collection<T> unique(Collection<T> self, boolean mutate) { List<T> answer = new ArrayList<T>(); for (T t : self) { // << Outer loop over each item boolean ...


4

Actually, Google published a paper around two years ago about this topic which describes what you have noticed here. C++ programs allow typically more optimizations than programs written in languages like Java/Scala/Go (or in your case Groovy), which gives more opportunities to make them faster - but for the price of increased programming effort. Said that, ...


3

I haven't used Struts for ages, but Struts by default can render Velocity markup, FreeMarker, as well as JSP (maybe other formats too). For example, to render FreeMarker pages, your action definitions would look like this: <action name="test" class="com.acme.TestAction"> <result name="success" ...


3

This question is based on completely misplaced assumption, that JVM languages are alternatives to each other. You're drawing analogy to JS toolkits, which all are using same language, all have same audience, all have same use. In case of JVM languages, the only thing in common all of them have, is that they are implemented using JVM. Apart of that it's as ...


3

I spent a bunch of time evaluating the different JVM languages. Groovy is really nice and well designed but the things I didn't quite like were: Too dynamic - it clearly wasn't going to be possible to write highly optimised code, which was one of my requirements Still focused on the OOP paradigm I eventually picked Clojure. It's also dynamic by ...


3

For me the answer is tool support. There is tooling for Groovy but its not as good as Java. Poor tooling is why I haven't done much Scala, Clojure etc as well. However, if you need to write a program to extract some stuff from XML, filter it and write it to a database... Groovy is very very good at these tasks. There are some big websites that are Grails ...


3

Back when I did Java development, I didn't use it for one of the worst reasons: the name. Now before anyone reaches for that downvote button, it wasn't my decision. I wanted to use Groovy and Drools for a project I was working on for a long term client. My project manager refused to allow us to use Groovy or Drools because he said he'd feel like an idiot ...



Only top voted, non community-wiki answers of a minimum length are eligible