Why groovy

For last projects i choose Groovy as a main programming language, where it’s possible. Why? Because i think it’s optimal solution for most of my projects.

It’s very pragmatic, agile, powerful and expressing language. You write less code that using Java, you don’t require to write all those “getters/setters”, wrappers, huge hierarchy of objects, etc.  If you know you can use some functional-kind tricks, so two hundred java code can be rewritten using few lines. And then it requires less time for refactor, for bugfixing, for code review, for understanding, etc, etc.

It also easy to start using it. Really. There a no learning curve. Basically it’s just plain Java with additional syntax sugar. So you can rename your *.java files to *.groovy, and, ta-da-dam, you are using Groovy :)  Maybe with some rare exceptions, but it works. And then, when you feel flavor of Groovy, you will start using its feautures. Event junior java developers can start using it after short introduction, i’ve tried to teach few juniors – just fine.

And also there are good documentation, very good IDE support (at least by IntelliJ IDEA) and by development tools (like Maven, code-coverage, etc).

JVM is my choice because i’m doing mostly server-side project, and there are no alternatives with such solid base. I has done some project using python and ruby, and even PHP and Perl, but don’t pleased of quality of libraries, development tools, etc. Of course I’ve spent some time on other languages for JVM. Scala, for example, can be good language, for some teams, but it have high learning curve, very chaotic infrastructure and syntax, and it’s too academic it think. Clojure is other good choice, i’ve used it for an small project (~8K SLOC), and can say that it’s cool, but it’s not solid, it’s too young, there are no tools and IDEs (only Emacs, but did you know any junior developer who want to use Emacs? :)), so it’s not ready for production use yet.

Main problem with Groovy that it’s slow language. But i have to say, that for last couple of years i worked on different datamining projects, and know that at leas 80% (sometimes 95%) of your time you spent on non critical code, on architecture, refactoring, etc. And using Groovy you can spent this time more effectively. And when you found an bottleneck – rewrite it using Java, if you wish. Or rewrite using C/C++. Or maybe assembler. But, you now, it’s always better to think more, and write more robust algorithm on high level. And most of libraries already written using plain Java, so it fast, of course not so fast as C, but faster that Groovy.

Share this post: Tweet about this on TwitterShare on RedditShare on FacebookShare on LinkedInShare on TumblrShare on StumbleUponShare on Google+Email this to someone
 

Igor Artamonov

Professional software developer since 2001, have been writing code since 1995. Data processing for Cloud, Ethereum & Blockchain

 
  • Sakuraba

    Did you try Groovy++ (Groovy with a little static typing) do speed up those bottlenecks?

  • Scala has a chaotic syntax? I am only starting to learn it, but I rarely saw a language so consistent in its design. Maybe the syntax sugar and flexibility might give the impression it is chaotic, but once you understood the base ideas behind the design choices, you see it is very regular.
    I don’t understand what you mean by “chaotic infrastructure”.
    And it isn’t too academic, since many enterprises chose it in their projects. Unless by “academic” you mean “based on solid computer science bases”…

    Now, I grant you Scala isn’t so easy to learn, because of the complex type system, and because it is so rich and introduces some new paradigms for Java programmers (functional programming, not mandatory, but powerful).
    Anyway, I feel it is worth learning because it pays at the end.

  • Pingback: Random Links #275 | YASDW - yet another software developer weblog()

  • Groovy++ is interesting indeed, but too immature. And Scala is indeed too over-engineered. I myself like the syntax Stab language, which is C# for JVM actually, but it is just a toy. :)

  • Mario Fusco

    Does Scala have chaotic syntax??? Oh, please

    Why not groovy: http://twitter.com/#!/mariofusco/status/25763978734

  • Pingback: Niche for Scala « Igor Artamonov()

  • Deborah Bradley

    I do believe Groovy is still better than Scala.

  • I totally agree with your ideas. Though Scala and Groovy are similar in most aspects, groovy is more dynamic and can be customized to your needs more efficiently. Groovy is more influenced by Java and Ruby. Though this software is on the slower side when compared with its contemporary ones, the ease with which you can design code and complexity allows you more space to relax and this is where Groovy earns its accolades.

  • Bobby

    I understand your reasons. Truly I do. Most people would agree. Groovy is an easier, more understandable and more straightforward language to use for programming. The problem is the complexity of Java makes it flexible and more dynamic.