Groovy for Domain-specific Languages - Second Edition

Extend and enhance your Java applications with domain-specific scripting in Groovy
Preview in Mapt

Groovy for Domain-specific Languages - Second Edition

Fergal Dearle

1 customer reviews
Extend and enhance your Java applications with domain-specific scripting in Groovy
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Groovy for Domain-specific Languages - Second Edition Book Cover
Groovy for Domain-specific Languages - Second Edition
$ 39.99
$ 28.00
Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition Book Cover
Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition
$ 35.99
$ 25.20
Buy 2 for $35.00
Save $40.98
Add to Cart

Book Details

ISBN 139781849695404
Paperback386 pages

Book Description

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

Chapter 1: Introduction to DSLs and Groovy
DSL – a new name for an old idea
Groovy
Summary
Chapter 2: Groovy Quick Start
Installing Groovy with GVM
How to find and install Groovy from binaries
Running Groovy
The Groovy IDE and editor integration
Summary
Chapter 3: Essential Groovy DSLs
Installing Gradle
Gradle basics
Spock tests
Further reading
Summary
Chapter 4: The Groovy Language
Introducing the Groovy language
Summary
Chapter 5: Groovy Closures
What is a closure?
Closures and collection methods
Closures as method parameters
Calling closures
Finding a named closure field
Closure parameters
Closure return values
The closure scope
Summary
Chapter 6: Example DSL – GeeTwitter
Twitter
Working with the Twitter APIs
Groovy improvements
Removing the boilerplate
Adding a command-line interface
Adding built-in methods
Summary
Chapter 7: Power Groovy DSL Features
Named parameters
Command chains
Builders
SwingBuilder
Method pointers
Metaprogramming and the Groovy MOP
How builders work
ExpandoMetaClasses
Summary
Chapter 8: AST Transformations
What is an AST
Compiler phases
Local AST transformations
Using ASTBuilder
Global AST transformations
Summary
Chapter 9: Existing Groovy DSLs
Grails object relational mapping – GORM
Spock as a DSL
Summary
Chapter 10: Building a Builder
The builder code structure
BuilderSupport
FactoryBuilderSupport
Summary
Chapter 11: Implementing a Rules DSL
Groovy bindings
Building a rewards DSL
Summary
Chapter 12: Integrating It All
Groovy as a teaching language
A game DSL for kids
A game DSL – goals
Summary

What You Will Learn

  • Familiarize yourself with Groovy scripting and work with Groovy closures
  • Use the meta-programming features in Groovy to build mini languages
  • Employ Groovy mark-up and builders to simplify application development
  • Familiarize yourself with Groovy mark-up and build your own Groovy builders
  • Build effective DSLs with operator overloading, command chains, builders, and a host of other Groovy language features
  • Integrate Groovy with your Java and JVM based applications

Authors

Table of Contents

Chapter 1: Introduction to DSLs and Groovy
DSL – a new name for an old idea
Groovy
Summary
Chapter 2: Groovy Quick Start
Installing Groovy with GVM
How to find and install Groovy from binaries
Running Groovy
The Groovy IDE and editor integration
Summary
Chapter 3: Essential Groovy DSLs
Installing Gradle
Gradle basics
Spock tests
Further reading
Summary
Chapter 4: The Groovy Language
Introducing the Groovy language
Summary
Chapter 5: Groovy Closures
What is a closure?
Closures and collection methods
Closures as method parameters
Calling closures
Finding a named closure field
Closure parameters
Closure return values
The closure scope
Summary
Chapter 6: Example DSL – GeeTwitter
Twitter
Working with the Twitter APIs
Groovy improvements
Removing the boilerplate
Adding a command-line interface
Adding built-in methods
Summary
Chapter 7: Power Groovy DSL Features
Named parameters
Command chains
Builders
SwingBuilder
Method pointers
Metaprogramming and the Groovy MOP
How builders work
ExpandoMetaClasses
Summary
Chapter 8: AST Transformations
What is an AST
Compiler phases
Local AST transformations
Using ASTBuilder
Global AST transformations
Summary
Chapter 9: Existing Groovy DSLs
Grails object relational mapping – GORM
Spock as a DSL
Summary
Chapter 10: Building a Builder
The builder code structure
BuilderSupport
FactoryBuilderSupport
Summary
Chapter 11: Implementing a Rules DSL
Groovy bindings
Building a rewards DSL
Summary
Chapter 12: Integrating It All
Groovy as a teaching language
A game DSL for kids
A game DSL – goals
Summary

Book Details

ISBN 139781849695404
Paperback386 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Java EE 7 First Look Book Cover
Java EE 7 First Look
$ 23.99
$ 16.80
Express Web Application Development Book Cover
Express Web Application Development
$ 29.99
$ 21.00
Getting started with IntelliJ IDEA Book Cover
Getting started with IntelliJ IDEA
$ 20.99
$ 14.70
OpenJDK Cookbook Book Cover
OpenJDK Cookbook
$ 26.99
$ 18.90
JasperReports for Java Developers Book Cover
JasperReports for Java Developers
$ 26.99
$ 18.90
Unity Character Animation with Mecanim Book Cover
Unity Character Animation with Mecanim
$ 39.99
$ 28.00