• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Groovy: using instead of shell UNIX scripting is its purpose?

 
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've been reading about Groovy and I'm enjoying learning it because it has similar syntax to Java.

I'd like to know if the use of Groovy is more recommended only in situations where I write scripts like the ones are written many times using shell script from UNIX. I've seen (on ancient projects) a .bat file which calls a java class with a "public void main" method, and I agree it is not an elegant code.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on a lot of factors. First, who has to maintain your scripts? If everyone else on your team is competent with bat file scripting, but doesn't understand Groovy, then you're going to be creating code that no one else can maintain.

If the people you work with do understand Java or Groovy, then you have to ask yourself "which language makes me more productive, and which language is easier to maintain ?".

HTH!
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think I've ever written a Groovy script professionally. It's all been about doing the things we used to do in Java but now in a much more expressive language.

Just regular, enterprise application code.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've written a few scripts in groovy but most were one time only things that would have take 4 times longer to write any otherg way. A couple of examples are here and here.

If you truly are a java shop then Groovy can make a whole lot of sense for this kind of thing. I'm currently consulting for a company that is PHP and Java. All their scripts are bash shell scripts. So to try and throw groovy into the mix would be a bad idea.
 
Rancher
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use Ant, then maybe Gant can do some of the things you are trying to do with your scripts. Gant is a Groovy-based build system that uses no XML.

I work with Groovy and Grails professionally, and I still write bourne scripts sometimes . But I grew up on a Sun; it may be that I just can't kick the habit.
reply
    Bookmark Topic Watch Topic
  • New Topic