• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What do I can do with Groovy that I can't with Java?

 
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'd like to know what kind of stuff do I can do with Groovy that I can't with Java.
In other words, which situations would be more vantajous using Groovy than only Java?

Thank you.
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know about groovy that it is built on JAVA itself and runs in same JVM. So I dont thnik that there is something that you can do with Groovy but not with Java.


Groovy makes the same task easier to write in that too in very less time as compared to Java.
[ October 21, 2008: Message edited by: Himanshu Gupta ]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I�m perhaps wrong but I think that with groovy, you can use scripts which are not directly compiled in code (as with any script language).
This allows you to adapt parts of your program�s feature without needing any development tool.

Chris
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Groovy is great for xml parsing. It's so much easier than parsing xml in Java.

http://groovy.codehaus.org/Reading+XML+using+Groovy's+XmlSlurper

http://groovy.codehaus.org/Reading+XML+using+Groovy's+XmlParser
[ October 21, 2008: Message edited by: Josh Brown ]
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christophe Deniaud:
Hello,

I�m perhaps wrong but I think that with groovy, you can use scripts which are not directly compiled in code (as with any script language).
This allows you to adapt parts of your program�s feature without needing any development tool.

Chris




This is what i got from Groovy website :

compiles straight to Java bytecode so you can use it anywhere you can use Java


So as far as I understand, groovy code is compiled and changed into byecode. That is why it is easy to use in Java just like any other java class.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's something you can do in groovy that you can't do in java. Write a string that doesn't need to escape backslashes.

Seriously though, there's not much you can do in groovy that you can't do in Java. On the flip side, almost anything you can do in Java can be done using less lines of code in groovy.
reply
    Bookmark Topic Watch Topic
  • New Topic