Friday, September 9, 2011

Groovy - A dynamic language for the Java Platform

http://groovy.codehaus.org/
  • is an agile and dynamic language for the Java Virtual Machine
  • builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk
  • makes modern programming features available to Java developers with almost-zero learning curve
  • supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain
  • makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications
  • simplifies testing by supporting unit testing and mocking out-of-the-box
  • seamlessly integrates with all existing Java classes and libraries
  • compiles straight to Java bytecode so you can use it anywhere you can use Java



•是一個基於 Java的虛擬機的敏捷動態語言
•構建在強大的爪哇語言之上並添加了從 Python和RubySmalltalk的等語言中學到的諸多特徵
•為 Java的開發者提供了現代最流行的編程語言特性而且學習成本很低幾乎為零)。
•支持DSL(領域特定
Goovy擁有處理原生類型面向對象以及一個 Ant的DSL,使得創建 Shell腳本變的非常簡單
•在開發網絡,GUI數據庫或控制台程序時通過減少框架性代碼大大提高了開發者的效率
•支持單元測試和模擬對象可以簡化測試
•無縫集成所有已經存在的Java的對象和類庫
•直接編譯成Java的字節碼這樣可以在任何使用的Java的地方使用Groovy的





Samples

A simple hello world script:
def name='World'; println "Hello $name!"
 
A more sophisticated version using Object Orientation:
class Greet {
  def name
  Greet(who) { name = who[0].toUpperCase() +
                      who[1..-1] }
  def salute() { println "Hello $name!" }
}

g = new Greet('world')  // create object
g.salute()              // Output "Hello World!"
            

No comments:

Post a Comment