Many folks have been asking me about why we are going with Groovy in Project Zero. Jason made us do it - The simple story is, after returning from a business trip, Jason McGee told me that he had added Groovy to the project. Done deal. 
DSL - The longer story has to do with the critical role dynamic scripting languages play in the agility of the Zero platform. Let’s face it. Dynamic scripting languages have arrived. They are real – not just for play. Their track record for expediting the process of constructing dynamic web-based applications is nothing sort of impressive. So, the question wasn’t “should we?” – It was “which is the right language(s) for Zero?”
J* - At first we played with all of the J* languages we could get our hands on. (e.g., JRuby, Jython, Rhino) This gave us a good feel for how to integrate with dynamic scripting languages atop Java. We strongly feel (along with 4 million other Java developers) that Java has a lot of good life left. So, a J* approach, which leverages many of the mature aspects of Java (e.g., VMs/JITs/GCs, Eclipse and the myriad of Java utils on the net), seemed like the right choice. We even built a PHP interpreter for Java to include in the study, to allow PHP to get into the mix.
PHP+Groovy - We quickly realized that supporting all languages was going to be a very costly proposition (think dev tools). So we narrowed the scope to PHP, the raining champ. (About 22 million web sites employ PHP) and a Java-based scripting language called BeanShell. We figured that by supporting Java and PHP syntaxes, we would utilize the programming skills of the majority of the world’s web-oriented programmers. BSH, was eventually replaced by Groovy (see Jason story above), because of the vibrant community behind Groovy, including a wealth of utilities and tools.
Groovy - I see Groovy as a nicotine patch for Java programmers. It weans Java programmers off the stringent OO world of Java, into the agile world of dynamic scripting. Richard Monson-Haefel, Sr. Analyst for Burton Group, says it best on his Blog “I, Analyst”.
| Groovy was built from the ground up with Java developers in mind. It’s retains much of the same syntax and semantics failure to Java developers while also offering dynamic language features like dynamic typing, mixings, and closures… These are the types of features that make dynamic languages much more productive than conventional languages. Finally, all the Java APIs that you use today can be used in exactly the same way in Groovy. Groovy compiles into byte code, so any Java API you can import and access in a Java program you can import and access in Groovy. |
Groovy in Zero - Within the Zero Platform, Groovy is well integrated and exemplifies many of the key features of the platform including Event Handling, Global Context, REST and Data Access. For example, REST services can be effortlessly implemented from Groovy using conventions (i.e., directory structure, collection/items.groovy scripts). From our WebSphere experience, we learned how balancing the notion of state and statelessness can lead to simplicity and scalability. Hence, in Zero, we introduce a shared memory space, which we call the Global Context – GC. The GC is easily accessible from our Groovy scripts and brings consistency to handling transient data and local configuration in a single application. Similarly, the Zero Data Access API is also well integrated into Groovy.
Now, to give credit to our PHP support, PHP does all of this in Zero as well – however, if you are coming from a Java background – Groovy will be your Nicotine patch and wean you into a world of dynamic scripting atop the Zero Platform.
- GAC


