featuring Dynamic Typing, Closures, Unit Testing with Spock, Metaprogramming and DSLs
contains over 11 hours of video - equivalent to 4 days of live training.
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.
Having problems? check the errata
Introduction 8m 46s A brief overview of the course, with details of our support system - in case you need help! |
Preview |
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" |
Watch |
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. |
Watch |
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. |
Watch |
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. |
Watch |
Methods 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. |
Watch |
Exceptions 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. |
Watch |
Strings 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 |
Watch |
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. |
Watch |
Operators 29m 45s Groovy features operator overloading. We cover many of the new operators, and show how to use operator overloading with our own methods. |
Watch |
Closures 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. |
Preview |
Lists 31m 57s Groovy has excellent support for lists, with special operators and a number of convenience methods built in. |
Watch |
Maps 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. |
Watch |
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. |
Watch |
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. |
Watch |
Practical Session Part 1 12m 7s On this Groovy training course, we build a full working application. This opening session starts the project. |
Watch |
Practical Session Part 2 9m 6s More coding of the example groovy program. |
Watch |
Practical Session Part 3 7m 33s Another programming exercise in Groovy |
Watch |
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. |
Watch |
Working with Objects 22m 38s Some advanced object concepts, including dynamic properties and exploring Groovy Truth - using objects in "if" and "assert" statements. |
Watch |
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. |
Watch |
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. |
Preview |
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. |
Watch |
Databases 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. |
Watch |
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) |
Watch |
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. |
Watch |
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. |
Watch |
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! |
Watch |
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. |
Watch |
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. |
Watch |
Packaging Applications 26m 1s How to distribute your application, how to call Groovy from Java and vice versa, and how to run Groovy Scripts. |
Watch |
Course Summary 6m 22s A review of the course and some guidance on where to go next. |
Watch |