Take your programming skills to the next level with our Java e-learning programme

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.

Pre-requisites

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.

1

Introduction


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

2

Getting Started


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

3

Groovy and Eclipse


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

4

Objects and Constructors


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

5

Dynamic Typing


18 m 53 s
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.

6

Methods


21 m 31 s
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.

7

Exceptions


13 m 8 s
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.

8

Strings


24 m 11 s
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

9

Ranges and Looping


16 m 6 s
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.

10

Operators


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

11

Closures


41 m 31 s
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.

12

Lists


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

13

Maps


18 m 18 s
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.

14

Regular Expressions


20 m 28 s
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.

15

Unit Testing


41 m 2 s
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.

16

Practical Session Part 1


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

17

Practical Session Part 2


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

18

Practical Session Part 3


7 m 33 s
Another programming exercise in Groovy

19

Practical Session Part 4


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

20

Working with Objects


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

21

Files and Templates


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

22

Object Extensions


16 m 4 s
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.

23

XML and Builders


25 m 42 s
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.

24

Databases


33 m 42 s
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.

25

Metaprogramming Part 1: Intercepting Methods


25 m 29 s
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)

26

Metaprogramming Part 2: Injecting Methods


25 m 57 s
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.

27

Metaprogramming Part 3: Synthesizing Methods


16 m 21 s
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.

28

Closure Variable Scope


13 m 55 s
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!

29

Domain Specific Languages (DSLs)


19 m 53 s
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.

30

Advanced Testing


30 m 14 s
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.

31

Packaging Applications


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

32

Course Summary


6 m 22 s
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