Strategic Scripting

212,773pages on
this wiki
Add New Page
Add New Page Discuss this page0


Scripting : The Groovy Language

I'm currently learning Groovy, a JCP accepted scripting language for the JVM, and potentially the official one in the upcoming 1.6 release of the Java Language Specification.

It's a dynamic AND statically typed language, strictly integrated with the Java language and binary compatible with the byte-code of the JVM.

Though it may seem "yet another scripting language for the JVM", it's quite different from projects like JRuby, Jython, Rhino or similar projects. In fact it has some feature which can make it a powerful competitor for other dynamic languages.

1) JCP specification : Groovy is a Java Community Process approved scripting language for the JVM. This means that specifications are managed by the same community of experts which elaborate the Java Specifications. Companies are notoriously more willing to adopt products and languages they can recognize or perceive as a standard of some sort. This will ensure strong support to the platform, just like appears evident looking at the amount of articles and papers released on the websites of Oracle, IBM and the like.

2) From Java developers, for Java developers: Groovy is grown from the ground up with a precise purpose in mind: deliver a dynamic language to the java platform, aiming the java developers community. This means that it's not a port of something else like Jython or JRuby. It's designed from scratch to be binary compatible with JVM bytecode, to ensure capability to reuse the existing pletora of java libraries. Compiled groovy is to all intents and purposes a java .class. This means that Groovy can use Java classes, and that Java can use Groovy classes seamlessly. Also, despite the huge amount of unusual (to a java devloper) features, like dynamic typing or closures, it maintain a familiar sintax and semantic. As a conclusion, this means that Groovy has the potential to be the preferred dynamic language for the java community, which is one of the biggest in the world.

3) Groovy vs Rest of the dynamic world: It's argueable that other dynamic languages such as Ruby has significant more features than Groovy. In other words, there seams not to be any serious "language related" questions influencing the choice between Groovy or another dynamic language. BUT there are many, if we look at the "environmental" questions. Python, or Ruby, may actually have a greater momentum, more hype, and larger communities of developers, but Groovy has a different approach. It reached JCP certification in 3 years, while other languages took plus than a decade to become popular. Development of the Groovy specifications proceeded silently, and this is probably a virtue. Now that it's ready, it's rapidly gaining popularity and acceptance. One key virtue of the Groovy language is that it's able to stop the "brain escape" of java developers to dynamic languages, since it offer to them the best of both worlds: the power and extent of the java platform AND the productivity and elegance of a dynamic language, under the same roof.

Uses of scripting in the Strategic Engine

The intention is to use a dynamic language such as Groovy to script the underlying engine implemented in a combination on Java and Groovy. The main purpose is to simplify the implementation of game rules in a manner which facilitates the integration of such rules with the whole system. Entities, events, properties, maps etc, will be described by Groovy classes, and the engine will then run them creating an environment where all this things will exists.

Also on Fandom

Random wikia