Groovy Finesse

Why would we use Groovy?
General Information

  HomePage - http://groovy.codehaus.org
  Groovy is open source using a BSD / Apache style licence
  Sun's defacto scripting language (JSR-241)
     http://www.jcp.org/en/jsr/detail?id=241
  Dynamic Language that is compiled into Java class
  bytecode
  The company behind Groovy and Grails (G2One) was just
  bought by a respectable company called SpringSource (the
  same one that does the support for Spring)
  70k downloads in November 2007 and growing
Benefits

  Easy for Java Developers to understand and adopt
  Is the Only JVM language interchangeable with Java code
      Compiled Groovy classes can be used from Java
      Compiled Java classes can be used from Groovy
      Can use Java syntax in Groovy seamlessly
  Growing community and interest
  The company behind Groovy G2One was just bought by a
  respectable company called SpringSource
  With the new stable release (1.6) that came out last week it
  brings forth performance improvements
  GroovyConsole provides a quick way to test out any
  arbitrary code
Benefits over Java

  More concise, cleaner syntax and has less syntax noise
  than Java
  Can be ran as shell scripts (just like Perl)
  Closures
     Closures are Objects that encapsulate behavior
     Have a scope that allows for clean exiting of external
     resources without writing explicit code
         Closing files gracefully
         Closing JDBC connections gracefully
         etc
      Currying allows to make more concise closures from
     other closures by providing defaults to parameters
Benefits over Java

  MOP - Meta Object Protocol
    Allows to inspect any arbitrary object
        Helper methods dump() or inspect() will expose the
        underlying attributes and their values
    Allows addition or modification of methods at runtime
    Allows the creation of DSLs
Benefits over Java

   Builders (a nice and clean patterns that allows to build
  complex objects using nested closures)
     MarkupBuilder - for HTML, XML etc
     JMXBuilder
     SwingBuilder
Features not Found in Standard Java

The Groovy language is largely a superset of the Java
language. One can usually rename a .java file to a .groovy one
and it will work (though there are a few gotchas). Groovy has a
number of features not found in standard Java.
This makes the learning curve for Java developers almost zero,
since they can start with Java syntax and gradually learn to add
Groovy features. [1] Groovy features not available in Java
include both static and dynamic typing (with the def keyword),
closures, operator overloading, native syntax for lists and
associative arrays (maps), native support for regular
expressions, polymorphic iteration, expressions embedded
inside strings, additional helper methods, and the safe
navigation operator "?." to automatically check for nulls (for
example, "variable?.method()", or "variable?.field")
Groovy Modules

 COM Scripting — script Windows ActiveX and COM components with
 Groovy
 Gant
 GFreeMarker — an integration of the FreeMarker template engine for
 Groovy
 GMaven — GMaven provides integration of the Groovy language into
 Maven.
 Google Data Support — makes using the Google Data APIs easier from
 within Groovy
 Gram — a simple xdoclet-like tool for processing doclet tags or Java 5
 annotations
 GraphicsBuilder — GraphicsBuilder is a Groovy builder for Java 2D
 Grapplet
 Griffon — Dekstop Enhancements for Groovy
 Groosh — Provides a shell-like capability for handling external processes.
 Groovy Jabber-RPC — allows you to make XML-RPC calls using the
 Jabber protocol
Groovy Modules

 GroovyJMS
 GroovyLab — Provides a domain specific language (DSL) for math
 engineering (matlab-like syntax).
 Groovy Monkey — is a dynamic scripting tool for the Eclipse Platform
 GroovyRestlet — Groovy DSL for constructing Restlet application
 Groovy Science
 Groovy SOAP — create a SOAP server and make calls to remote SOAP
 servers using Groovy
 GroovySWT — a wrapper around SWT, the eclipse Standard Widget
 Toolkit
 GroovyWS — GroovySOAP replacement that uses CXF and Java5
 features
 GSP — means GroovyServer Pages, which is similar to JSP (JavaServer
 Pages)
 GSQL — supports easier access to databases using Groovy
 HTTP Builder — provides a convenient builder API for complex HTTP
 requests
 JideBuilder — JideBuilder is a Groovy builder for the open source JIDE
Groovy Modules

 Native Launcher — a native program for launching groovy scripts
 Proxy-o-Matic — Proxy-o-Matic lets you create dynamic proxies fast and in
 an homogeneous way
 Windows NSIS-Installer — a Windows-specific installer for Groovy
 Windows Services — framework for Groovy-based WinNT (Windows)
 Services
 WingSBuilder — WingsBuilder is a Groovy builder for the wingS
 Framework
 XMLRPC — allows you to create a local XML-RPC server and/or to make
 calls on remote XML-RPC servers
 Grails — a Groovy-based web framework inspired by Ruby on Rails
 GORM — the Grails Object-Relational Mapping persistence framework
 GroovyPlugin — A Groovy plugin for JSPWiki
 OCM Groovy — A Object Content Mapping implemented in Groovy
 leveraging the Java Content Repository (JCR)
 Tellurium — A test framework built on top of the Selenium test framework
 implemented in Groovy
IDE Support

 Debugging with JSwat
 Eclipse Plugin
 IntelliJ IDEA Plugin
 IntelliJ IDEA Plugin (JetBrains Edition)
 JEdit Plugin
 NetBeans Plugin
 Oracle JDeveloper Plugin
 Other Plugins
 TextMate
Project Build Management

 Maven
 Ant
 Gradle
Groovy Books

 Groovy In Action (Manning)
 Programming Groovy: Dynamic Productivity for the Java
 Developer (Pragmatic Programmers)
 Groovy Recipes: Greasing the Wheels of Java (Pragmatic
 Programmers)
 Beginning Groovy and Grails: From Novice to Professional
 (Apress)
 Groovy Programming: An Introduction for Java Developers
 (Morgan Kaufmann)
 Groovy and Grails Recipes: Recipes a Dynamic Approach
 (Apress)
 The Definitive Guide to Grails (Apress)
 The Definitive Guide to Grails: Second Edition (Apress)
 Getting Started with Grails (Lulu.com)
Who Uses Groovy?

 Mule ESB
 ServiceMix ESB
 Spring
 Grails
 LinkedI

Groovy Finesse

  • 1.
  • 2.
    General Information HomePage - http://groovy.codehaus.org Groovy is open source using a BSD / Apache style licence Sun's defacto scripting language (JSR-241) http://www.jcp.org/en/jsr/detail?id=241 Dynamic Language that is compiled into Java class bytecode The company behind Groovy and Grails (G2One) was just bought by a respectable company called SpringSource (the same one that does the support for Spring) 70k downloads in November 2007 and growing
  • 3.
    Benefits Easyfor Java Developers to understand and adopt Is the Only JVM language interchangeable with Java code Compiled Groovy classes can be used from Java Compiled Java classes can be used from Groovy Can use Java syntax in Groovy seamlessly Growing community and interest The company behind Groovy G2One was just bought by a respectable company called SpringSource With the new stable release (1.6) that came out last week it brings forth performance improvements GroovyConsole provides a quick way to test out any arbitrary code
  • 4.
    Benefits over Java More concise, cleaner syntax and has less syntax noise than Java Can be ran as shell scripts (just like Perl) Closures Closures are Objects that encapsulate behavior Have a scope that allows for clean exiting of external resources without writing explicit code Closing files gracefully Closing JDBC connections gracefully etc Currying allows to make more concise closures from other closures by providing defaults to parameters
  • 5.
    Benefits over Java MOP - Meta Object Protocol Allows to inspect any arbitrary object Helper methods dump() or inspect() will expose the underlying attributes and their values Allows addition or modification of methods at runtime Allows the creation of DSLs
  • 6.
    Benefits over Java Builders (a nice and clean patterns that allows to build complex objects using nested closures) MarkupBuilder - for HTML, XML etc JMXBuilder SwingBuilder
  • 7.
    Features not Foundin Standard Java The Groovy language is largely a superset of the Java language. One can usually rename a .java file to a .groovy one and it will work (though there are a few gotchas). Groovy has a number of features not found in standard Java. This makes the learning curve for Java developers almost zero, since they can start with Java syntax and gradually learn to add Groovy features. [1] Groovy features not available in Java include both static and dynamic typing (with the def keyword), closures, operator overloading, native syntax for lists and associative arrays (maps), native support for regular expressions, polymorphic iteration, expressions embedded inside strings, additional helper methods, and the safe navigation operator "?." to automatically check for nulls (for example, "variable?.method()", or "variable?.field")
  • 8.
    Groovy Modules COMScripting — script Windows ActiveX and COM components with Groovy Gant GFreeMarker — an integration of the FreeMarker template engine for Groovy GMaven — GMaven provides integration of the Groovy language into Maven. Google Data Support — makes using the Google Data APIs easier from within Groovy Gram — a simple xdoclet-like tool for processing doclet tags or Java 5 annotations GraphicsBuilder — GraphicsBuilder is a Groovy builder for Java 2D Grapplet Griffon — Dekstop Enhancements for Groovy Groosh — Provides a shell-like capability for handling external processes. Groovy Jabber-RPC — allows you to make XML-RPC calls using the Jabber protocol
  • 9.
    Groovy Modules GroovyJMS GroovyLab — Provides a domain specific language (DSL) for math engineering (matlab-like syntax). Groovy Monkey — is a dynamic scripting tool for the Eclipse Platform GroovyRestlet — Groovy DSL for constructing Restlet application Groovy Science Groovy SOAP — create a SOAP server and make calls to remote SOAP servers using Groovy GroovySWT — a wrapper around SWT, the eclipse Standard Widget Toolkit GroovyWS — GroovySOAP replacement that uses CXF and Java5 features GSP — means GroovyServer Pages, which is similar to JSP (JavaServer Pages) GSQL — supports easier access to databases using Groovy HTTP Builder — provides a convenient builder API for complex HTTP requests JideBuilder — JideBuilder is a Groovy builder for the open source JIDE
  • 10.
    Groovy Modules NativeLauncher — a native program for launching groovy scripts Proxy-o-Matic — Proxy-o-Matic lets you create dynamic proxies fast and in an homogeneous way Windows NSIS-Installer — a Windows-specific installer for Groovy Windows Services — framework for Groovy-based WinNT (Windows) Services WingSBuilder — WingsBuilder is a Groovy builder for the wingS Framework XMLRPC — allows you to create a local XML-RPC server and/or to make calls on remote XML-RPC servers Grails — a Groovy-based web framework inspired by Ruby on Rails GORM — the Grails Object-Relational Mapping persistence framework GroovyPlugin — A Groovy plugin for JSPWiki OCM Groovy — A Object Content Mapping implemented in Groovy leveraging the Java Content Repository (JCR) Tellurium — A test framework built on top of the Selenium test framework implemented in Groovy
  • 11.
    IDE Support Debuggingwith JSwat Eclipse Plugin IntelliJ IDEA Plugin IntelliJ IDEA Plugin (JetBrains Edition) JEdit Plugin NetBeans Plugin Oracle JDeveloper Plugin Other Plugins TextMate
  • 12.
    Project Build Management Maven Ant Gradle
  • 13.
    Groovy Books GroovyIn Action (Manning) Programming Groovy: Dynamic Productivity for the Java Developer (Pragmatic Programmers) Groovy Recipes: Greasing the Wheels of Java (Pragmatic Programmers) Beginning Groovy and Grails: From Novice to Professional (Apress) Groovy Programming: An Introduction for Java Developers (Morgan Kaufmann) Groovy and Grails Recipes: Recipes a Dynamic Approach (Apress) The Definitive Guide to Grails (Apress) The Definitive Guide to Grails: Second Edition (Apress) Getting Started with Grails (Lulu.com)
  • 14.
    Who Uses Groovy? Mule ESB ServiceMix ESB Spring Grails LinkedI