Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Groovy for Domain-Specific Languages, Second Edition
  • Toc
  • feedback
Groovy for Domain-Specific Languages, Second Edition

Groovy for Domain-Specific Languages, Second Edition

By : Dearle
4.7 (3)
close
Groovy for Domain-Specific Languages, Second Edition

Groovy for Domain-Specific Languages, Second Edition

4.7 (3)
By: Dearle

Overview of this book

The times when developing on the JVM meant you were a Java programmer have long passed. The JVM is now firmly established as a polyglot development environment with many projects opting for alternative development languages to Java such as Groovy, Scala, Clojure, and JRuby. In this pantheon of development languages, Groovy stands out for its excellent DSL enabling features which allows it to be manipulated to produce mini languages that are tailored to a project’s needs. A comprehensive tutorial on designing and developing mini Groovy based Domain Specific Languages, this book will guide you through the development of several mini DSLs that will help you gain all the skills needed to develop your own Groovy based DSLs with confidence and ease. Starting with the bare basics, this book will focus on how Groovy can be used to construct domain specific mini languages, and will go through the more complex meta-programming features of Groovy, including using the Abstract Syntax Tree (AST). Practical examples are used throughout this book to de-mystify these seemingly complex language features and to show how they can be used to create simple and elegant DSLs. Packed with examples, including several fully worked DSLs, this book will serve as a springboard for developing your own DSLs.
Table of Contents (14 chapters)
close
Free Chapter
1
1. Introduction to DSLs and Groovy
13
Index

Chapter 5. Groovy Closures

In this chapter, we will focus exclusively on closures. We touched upon closures already in the previous chapter. Now, we will take a close look at them from every angle. Why devote a whole chapter of the book to one aspect of the language? The reason is that closures are the single most important feature of the Groovy language. Closures are the special seasoning that helps Groovy stand out from Java. They are also the single most powerful feature that we will use when implementing DSLs. In this chapter, we will discuss the following topics:

  • We will start by explaining just what a closure is and how we can define some simple closures in our Groovy code
  • We will look at how many of the built-in collection methods make use of closures for applying iteration logic, and see how this is implemented by passing a closure as a method parameter
  • We will look at the various mechanisms for calling closures, and we will take a look under the covers at how Groovy implements...
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete