• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

why groovy? or when will developer use it?

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

I can't ignore the buzz that Groovy receives; I'm a struts developer and wonder how can Groovy help me? can I integrate Groovy with my 'actions' or can I build a model with Groovy and integrate it with my application?

Basically, I would like to know why developers will use Groovy if they're already proficient with Java, I'd appreciate if anyone can give a concrete example.

Thank you
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
---
 
Chris Baron
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,
i'am a beginner with Groovy and i found the enhancement of Java IO quite convicing


Compare this to how you usually open, read and print out a file in Java.
Here are 2 more examples with Groovy File IO

Of course there are much much more features that make coding groovier

cb
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mm...ok, I downloaded it to my eclipse and played for a while. I'm still debating as per the usage.
thanks Chris for the input
 
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 hate the File IO groovy example. See why here:

http://www.greggbolinger.com/blog/2009/03/26/1238072820000.html

 
Greenhorn
Posts: 20
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,

With JSR 223, Java has support for executing scripts (like Groovy) inside of your Java class files. So in your case, you can have actions that make calls to execute static Groovy scripts that can help your application be more dynamic at run-time. These scripts can live in a database or on a file system and can be updated while your Struts Web app is still running. You will see your changes the next time the script is executed. Maybe you want to change some validations, business rules, event notifications?

If you are familiar with Spring, you can check out Spring 2.0's support for dynamic languages (JRuby, Groovy, Beanshell). I think from this perspective, you can look into Groovy to come up with solutions that makes your life easier.
 
reply
    Bookmark Topic Watch Topic
  • New Topic