Skip to main content


developerWorks  >  Java technology  >

Fluently Groovy

Java application development using Groovy's simple syntax

developerWorks

Level: Introductory

Andrew Glover (aglover@stelligent.com), President, Stelligent Incorporated

26 Mar 2008

Register now or sign in using your IBM ID and password.

This tutorial is for Java™ developers unfamiliar with Groovy, who want a quick and easy introduction to the basics. Get started with Groovy's simplified variation of the Java syntax and learn about essential features like native collections, built-in regular expressions, and closures. Write your first Groovy class, and then see how easily you can use JUnit to test it. You'll walk away from this one-hour tutorial with a fully functioning Groovy development environment and the skills to use it. Best of all, you'll have learned first-hand how to use Groovy and Java code together in your everyday Java application development.

In this tutorial

Groovy is a lot like Java 2.0, if someone set out to completely rewrite the Java language today. Rather than replacing Java, Groovy complements it, providing a simpler, slicker syntax where the type checking is done dynamically at runtime. You can use Groovy to write Java applications on the fly, to glue together Java modules, or even to extend existing Java applications — you can even use Groovy to unit test your Java code. And the beauty of it is, Groovy lets you do all these things faster — sometimes a lot faster — than you would if you were writing pure Java code.

In this tutorial, you'll get to know Groovy, a dynamic language that sits as comfortably on the Java platform as does the Java language itself.


Objectives

  • Discover the fundamental concepts of Groovy

  • Create a Groovy project

  • Import Groovy to your project

  • Learn about Groovy collections, Groovy classes, and the Groovy syntax

  • Understand the benefits of using Groovy with Java

Prerequisites

To get the most from this tutorial, you should be familiar with Java syntax and the basic concepts of object-oriented development on the Java platform.


System requirements

To follow along and try out the code for this tutorial, you need a working installation of either

In addition, this tutorial assumes you are using the Eclipse IDE. You do not need to have Groovy installed as the tutorial walks you through the Groovy Eclipse plug-in installation.

The recommended system configuration for this tutorial is as follows:

  • A system supporting either the Sun JDK 1.5.0_09 (or later) or the IBM JDK 1.5.0 SR3 with at least 500 MB of main memory
  • At least 20 MB of disk space to install the software components and examples covered

The instructions and examples in the tutorial are based on a Microsoft Windows operating system. All the tools covered in the tutorial also work on Linux and Unix systems.



Duration

1-2 hours


Formats

html, pdf


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community