Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Fluently Groovy

Java application development using Groovy's simple syntax

Andrew Glover (aglover@stelligent.com), President, Stelligent Incorporated
Andrew Glover is president of Stelligent Incorporated, which helps companies embrace developer testing strategies and continuous integration techniques that enable teams to deliver software faster. Check out Andy's blog for a list of his publications.

Summary:  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.

Date:  26 Mar 2008
Level:  Introductory PDF:  A4 and Letter (1181 KB | 51 pages)Get Adobe® Reader®

Activity:  83860 views
Comments:  

Before you start

Learn what to expect from this tutorial and how to get the most out of it.

About 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

This tutorial guides you step-by-step through the fundamental concepts of Groovy. You will learn about Groovy collections, Groovy classes, and, of course, the Groovy syntax. When you are done with this one-hour tutorial, you will understand the benefits of using Groovy with Java (and vice versa), and you'll be set to start using Groovy in your everyday Java development.


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.

1 of 15 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology
ArticleID=297311
TutorialTitle=Fluently Groovy
publish-date=03262008
author1-email=aglover@stelligent.com
author1-email-cc=