First they ignore you
then they ridicule you
then they fight you
then you win
    -- Mahatma Gandhi
Chinese => English     英文 => 中文             
随笔-219  评论-1047  文章-0  trackbacks-0

Who Is Using Groovy


Stelligent: How are people using Groovy- what projects are you aware of that rely on Groovy?

Guillaume: In fact, we don't hear that much about how people use Groovy in their projects. People are usually more talkative when they have problems, rather than when they're happy with something!

Most of the time, they embed Groovy in their J2EE application as a scripting language: they like using our Groovlet servlets and our template engines. Some others use Groovy as a shell language replacement, or as a testing platform because tests are easy to write in Groovy. A few persons use Groovy as a prototyping tool to create demos for their customers. There are many use cases, really.

Every six months or so, I try to make a small survey on the Groovy mailing lists, to know what people think about Groovy, and what they do with it. There are some funny cases, like a guy who used Groovy to control his homemade robots, and he reported that using Groovy really saved him hundreds of lines of code and he could concentrate more on the AI logic of his robots than on the boring and tedious coding tasks!

To name a few projects that already embed Groovy successfully, you may have a look at:
  • Drools: a rule engine that allows you to write your conditions and consequences in Groovy.
  • The RIFE MVC/Web framework also permits you to write actions in Groovy or to configure the webapp layout and flow.
  • The eXo Platform (Portlet/Service container) uses Groovy in its core, and you can even write some Portlets in Groovy.
  • XWiki, a wiki engine and application platform, embeds Groovy for advanced wiki programming, like writing plug-ins or macros, or for pages containing some logic, etc.
Many other projects utilize Groovy as a dynamic extension mechanism. These examples are the best examples I know. I've listened to a few guys discretely whispering to me that they have deployed Groovy in their apps for months already, even with old betas of Groovy which weren't really considered mature enough!
Stelligent: Yep, I've heard the same thing! As we all know, Groovy isn't the only scripting language available for Java. If someone in the Java community was looking at adopting a scripting language for use and they were comparing Groovy and Jython- what would you say?

Guillaume: It's hard for me to compare Groovy with other languages. I haven't played much with the alternatives, and I guess I'm pretty biased :-)

Before Groovy arrived on the Java-place, the other scripting languages were a bit stalled, without any real innovation going on, or sustained activity. Fortunately, Groovy renewed the interest in the field, and thankfully, development was reborn on Jython, BeanShell or JRuby. That's a very good thing!

Now, regarding the choice, except if you need particular Groovy features not available anywhere else (like our builders, or handy libraries for SQL, etc.), I think the decision is around the knowledge of the developers: If the developer is very familiar with Ruby or Python, it's certainly a good idea to choose the Java-esque counterpart. If you prefer staying as close as possible to Java, choose BeanShell, or if you're a JavaScript guru, don't go further than Rhino.

Some compelling features may direct you to Groovy, and its Java-ish syntax may be appealing to you. Choosing a scripting language is really about analyzing the set of language and API features you need, and the knowledge your users have regarding other languages.

Stelligent: As a final thought- what other projects do you find interesting?

Guillaume: There are plenty of them!

But since it's a Groovy related interview, let me mention some projects embedding or using Groovy that I'm quite a fan of:
  • Ludovic Dubost's XWiki project, a second generation wiki engine and collaborative application platform, embeds Groovy as a way to extend XWiki by writing templates or plug-ins, or to manipulate the domain classes and objects you define in your pages. That's a really powerful platform for writing custom applications on top of a wiki engine. I like the fact it's a wiki (with all the standard features you can expect from a wiki), but it is more advanced than say Confluence, in the way it allows you to write custom forms or logic on top of your documents. And Groovy is a key element for that innovative aspect of the project.
  • I'm expecting a lot from a newly born Groovy sub-project called Grails which is a promising webapp framework for CRUD oriented apps, following an MVC approach, with a transparent persistence mechanism, and which applies the coding by convention paradigm to lower or remove the need for long and boring XML configuration or mapping files and other boilerplate code. It's really just in its infancy (started in early July), but I think it has a very high potential to become a driver for the whole Groovy community and for providing an easy introduction to webapps development for new Java developers. Stay tuned!
  • There are other interesting projects using Groovy, such as Geert Bevin's RIFE framework which contains a CRUD-part which allows you to define your domain classes in Groovy, and ta-da, you've got a CRUD webapp deployed in no time. There's also the eXo Platform from Benjamin Mestrallet which uses Groovy in its core for various things.
原文地址:http://www.stelligent.com/content/articles/article.php?topicId=81&pageName=Who+Is+Using+Groovy
附:Groovy轻松入门——Grails实战之GORM篇
posted on 2007-04-16 20:23 山风小子 阅读(1065) 评论(1)  编辑  收藏 所属分类: Groovy & Grails