Slashdot Mirror


Your Thoughts on the Groovy Scripting Language?

lelitsch asks: "Does anyone have first hand experience with Groovy? I am just coming off implementing a Plone-based intranet CMS and got hooked on scripting languages and Python all over again. Since most of my projects in the near future are going to be in Java or have large Java components, I was wondering if it's time to trade Jython--which seems to be falling further behind the Python release cycle--for something else. Groovy sounds like a fun thing to look at, but it seems a bit new and thin. Also, what are other languages (JRuby and Rhino, for example) you have used to script in Java?"

11 of 128 comments (clear)

  1. Jython and CPython by CRCulver · · Score: 4, Insightful

    I was wondering if it's time to trade Jython--which seems to be falling further behind the Python release cycle...

    Who cares if Jython is a little behind CPython if it already has all the features you need at this point? When I do work with CPython, I work from a relatively old edition of O'Reilly's Python in a Nutshell as reference, and find that the language at version 2.0 already does everything I need it to. While features added at 2.2 and 2.4 are undoubtedly useful for certain audiences, the language itself was complete for most purposes some time ago, and Jython should serve most people fine.

    1. Re:Jython and CPython by bwt · · Score: 3, Informative

      Groovy offers significant advantages over jython and jruby because it was designed specifically to run in the JVM. In particular: a) groovy's class library is the java class library -- you do not subject development teams to two competing sets of class libraries, b) groovy compiles to bytecode which means its interoperability with java is seamless c) groovy can and does actually add syntax and functionality to existing java classes via the GDK.

      The problem with groovy is that it is young. It is just starting into the release candidate phase. Some people have written articles bashing groovy for missing expected features like good parsing error feedback. These articles are unfair since they are evaluating a product that is unfinished. I do not recommend groovy for any production purpose yet, it's simply not ready.

  2. Bean Shell Script by Elias+Ross · · Score: 5, Informative

    From what I've seen, Groovy's a half-baked programming language and unfinished product. See this criticism for a start.

    If you want to do embedded scripting in Java, I suggest Bean Shell instead. As a library, Bean Shell is about 280K, Groovy is about 1.7M. And Bean Shell has been around for a lot longer.

    I'd like to see Sun add closures and better support for lists/maps in Java itself (e.g. a map function). I'm hoping that pressure from Ruby will make the language grow. C# already made them change their mind about Generics.

    1. Re:Bean Shell Script by Will+Sargent · · Score: 4, Informative

      Also see Mike Spille's criticism.

  3. Why? by zaguar · · Score: 4, Insightful

    I think you always need a reason before you try something new and unproven. If it is an enterprise app, why? Is there a feature that Python et al. does not do? If you have no experience with it, and no good reason to switch - Why bother?

    --
    "Sure there's porn and piracy on the Web but there's probably a downside too."
  4. Nothing beats Lua by Cthefuture · · Score: 4, Informative

    for lightness and performance. At least as far as scripting languages go. I can't say I'm a fan of Java but if you insist:

    There is Java/Lua integration in the form of JLua and LuaJava. Possibly other tools as well.

    --
    The ratio of people to cake is too big
    1. Re:Nothing beats Lua by Johnso · · Score: 3, Informative
      Seconded. Lua is the nicest scripting language I've worked with. It embeds beautifully in both Java and .Net.

      http://lua-users.org/ is your friend.

      --
      I'm a signature virus. Please copy me to your signature so I can replicate.
    2. Re:Nothing beats Lua by david.given · · Score: 3, Interesting
      for lightness and performance. At least as far as scripting languages go.

      *nods*

      I never use anything else any more --- it's small (compiling into an 200kB binary with no dependencies on my platform), it's fast (faster than Python!), it's simple (you can easily understand the entire language), it's elegant (closures, coroutines, a superb callout interface...), and it's flexible (there's enough functionality under the surface that you can, e.g., rewrite the OO system to better suit your needs). It's also BSD licensed, which means that there are no legal hurdles to using it in your project; if you play games, you've probably already used Lua without realising it.

      I will admit to not being overly enamoured with its syntax --- it uses Pascalish if...then...end style rather than C's if () {} style --- but I can easily live with that.

      Testimonial: I wrote a gaim plugin not long ago for the Citadel BBS. It was easier to bolt the Lua engine onto gaim and write the logic in gaim rather than try and figure out how to do it in gaim. Lua's coroutines support allowed me to turn gaim's callback-based API into a callout-based structure, which in turn allowed me to invert all my nasty complex state machines, which made the whole thing an order of magnitude less complex. Good stuff.

  5. Re:Stop the groovy naming by Anonymous Coward · · Score: 5, Funny

    I pronoune it D-rulez for that very reason. Then I throw up some gang signs.

  6. Indent by Vexorian · · Score: 3, Funny

    At least it uses brackets instead of depending on indentation .

    --

    Copyright infringement is "piracy" in the same way DRM is "consumer rape"
  7. Everyone overemphasizes the language by danpsmith · · Score: 4, Insightful

    A language doesn't have to be updated every 20 seconds to be good. If you started off working in JPython, I don't understand why you would switch it out for a less supported, and less developed language. Python has been kicking around for a while, enough time that they got most of the major kinks out long ago, so I don't think "falling behind in the development cycle" is as crucial as you might think it is. Why not stay with what works unless you specifically REQUIRE the new version's functionality? People are too quick to be trendy with languages...

    --
    Judges and senates have been bought for gold; Esteem and love were never to be sold.