Improve your coding skills from beginner to expert with the largest online Java e-learning platform

Groovy Programming

featuring Dynamic Typing, Closures, Unit Testing with Spock, Metaprogramming and DSLs
  • Become an expert Groovy Programmer with our extensive Groovy Training Course. Starting from the basics of the language, this highly practical video training course builds up to advanced training sessions, including topics such as Domain Specific Languages, Metaprogramming, and using Stubs and Mocks for testing. It contains everything you need to become an expert Groovy Programmer.
  • The course contains 11 hours of video material, but many of the chapters contain worked exercises for you to undertake, so you should expect to take around a week to complete the Groovy training course.
  • The course is created in two parts – chapters 1 to 15 cover the fundamentals of Groovy, and chapters 20 to 32 cover advanced programming. In the middle we introduce a case study with a major practical exercise.
  • As well as the video files, the course contains all the software you need (except groovy and your development environment, but we talk you through installing these), lots of sample code, and some guidance notes for the practical exercises in PDF format.
  • The course is written using Groovy version 2.2.2, although it can still be used with versions of Groovy prior to 2.0 – we make it clear when there is functionality that requires 2.0 or greater of Groovy.


The course assumes no previous knowledge or experience of Groovy. As Groovy is closely related to Java, some knowledge of Java is assumed and frequent comparisons are made, especially in the early chapters.

We cover everything right from the start - including how to install Groovy and configure a development environment. Students completely new to programming should consider taking the Java Fundamentals course before starting this course.

This course does not cover Grails, although the course is written to enable Grails developers to get the most benefit from using this environment, by learning how to use the powerful features of the Groovy language.

Contents - contains over 11 hours of video - equivalent to 4 days of live training.


Having problems? check the errata for this course.



8m 46s
A brief overview of the course, with details of our support system - in case you need help!


Getting Started

11m 33s
Understanding the relationship between Groovy, Java and the Java Virtual Machine, Installing Groovy, and creating your first groovy program - "Hello World"


Groovy and Eclipse

10m 44s
We will be using Eclipse for the Groovy Training. In this chapter we talk through installing Eclipse and configuring it to work with Groovy.


Objects and Constructors

30m 21s
How to write a class in Groovy, including the Groovy features for accessing fields within classes, and options for creating constructors.


Dynamic Typing

18m 53s
Also known as "Duck Typing", this is perhaps the biggest difference between Java and Groovy. We’ll understand how to use the “def” keyword, explore the benefits and risks of dynamic typing, and discuss when to use dynamic typing or static typing.



21m 31s
This chapter considers the options for creating methods in Groovy, covering method signatures, optional parameters, the return keyword, calling methods and creating methods that return multiple values.



13m 8s
There is one major difference in the way Groovy handles exceptions compared to Java – we find out what this is in this chapter, and how this allows us to write efficient code.



24m 11s
Based on the standard Java String, Groovy goes further and adds flexibility and power to make your programming life easier. We cover string interpolation, multi-line strings in this chapter


Ranges and Looping

16m 6s
Groovy makes creating simple loops very easy and removes the need for creating iterators too – we’ll see how this works in this chapter. We’ll also learn about the range object.



29m 45s
Groovy features operator overloading. We cover many of the new operators, and show how to use operator overloading with our own methods.



41m 31s
Closures are probably one the most important features of Groovy, and we introduce them here, and explain in detail how to create and use closures.



31m 57s
Groovy has excellent support for lists, with special operators and a number of convenience methods built in.



18m 18s
As with lists, there are special operators and convenience methods for maps that make working with them a pleasure. Maps are used extensively in Groovy so we study them in detail here.


Regular Expressions

20m 28s
This is an optional chapter – Groovy makes working with regular expressions to undertake powerful string searches significantly easier than in Java, with the use of slashy strings and special operators.


Unit Testing

41m 2s
We cover how to use JUnit in Groovy, see the enhancements that GroovyTestCase brings, and then we switch to use Spock - a very powerful testing framework that you might choose to use. More recent version of Grails use Spock as the default testing framework.


Practical Session Part 1

12m 7s
On this Groovy training course, we build a full working application. This opening session starts the project.


Practical Session Part 2

9m 6s
More coding of the example groovy program.


Practical Session Part 3

7m 33s
Another programming exercise in Groovy


Practical Session Part 4

8m 40s
This completes the first part of your sample groovy application. We will be returning to this application through the rest of the course.


Working with Objects

22m 38s
Some advanced object concepts, including dynamic properties and exploring Groovy Truth - using objects in "if" and "assert" statements.


Files and Templates

21m 43s
Learn how to quickly and easily handle, read and write text files, and the very powerful templating functionality that Groovy provides.


Object Extensions

16m 4s
This is an optional chapter that shows how to extend objects which we don’t have the normal ability to edit – for example adding our own functionality to a standard Java class.


XML and Builders

25m 42s
Groovy can read and write XML documents easily – we look in detail in this chapter at how to create XML and parse XML, creating objects from it.



33m 42s
In this session we add database functionality to your Groovy application, using JDBC. We’ll see how Groovy takes care of resource management and automatically creates prepared statements.


Metaprogramming Part 1: Intercepting Methods

25m 29s
Metaprogramming is an advanced technique, and we start with how to intercept methods, to change what they do, or stop them running, we explain why you might want to do this. This chapter also talks about Aspect Oriented Programming (AOP)


Metaprogramming Part 2: Injecting Methods

25m 57s
We can add methods "on the fly" in Groovy - here we show the 3 different ways to do this, and discuss how to identify the most appropriate way for a particular task.


Metaprogramming Part 3: Synthesizing Methods

16m 21s
In Groovy it is possible to call a method that doesn't exist - and do something useful! We can achieve a lot with this clever technique, and we prove this with a worked example.


Closure Variable Scope

13m 55s
A common misunderstanding with closures is the scope of variables and methods. We look at this issue, and learn how to change the scope to make parameters and methods visible to closures. You will need to know about this for the following chapter!


Domain Specific Languages (DSLs)

19m 53s
DSLs are becoming very popular, and in Groovy it is much easier to create one. We show a full example DSL with sample groovy code, explaining along the way WHY and HOW it works.


Advanced Testing

30m 14s
We explain the dependency problem in unit testing, and then see how to use Stubs, Mocks and Expandos in Groovy, together with Metaprogramming techniques, to remove these dependencies.


Packaging Applications

26m 1s
How to distribute your application, how to call Groovy from Java and vice versa, and how to run Groovy Scripts.


Course Summary

6m 22s
A review of the course and some guidance on where to go next.

Let the Course Come to You

About Us Pricing Frequently Asked Questions Contact Privacy T&Cs Affiliates and Resellers
Facebook Twitter YouTube LinkedIn