Groovy for Domain-Specific Languages

Java developers who need to build Domain-Specific Languages into their applications will find this book the passport to doing it with Groovy. Even the trickiest concepts are explained clearly and methodically.

Groovy for Domain-Specific Languages

Fergal Dearle

1 customer reviews
Java developers who need to build Domain-Specific Languages into their applications will find this book the passport to doing it with Groovy. Even the trickiest concepts are explained clearly and methodically.
Mapt Subscription
FREE
$29.99/m after trial
eBook
$18.90
RRP $26.99
Save 29%
Print + eBook
$44.99
RRP $44.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
$18.90
$44.99
$29.99p/m after trial
RRP $26.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781847196903
Paperback312 pages

Book Description

You may already be aware that the Java virtual machine runs on everything from the largest mainframe to the smallest microchip and supports almost every conceivable application. What you may not realize is that to develop software in some of these scenarios requires a targeted, single purpose language, a Domain Specific Language. The popular scripting language Groovy can be used to create a Domain Specific Language that can run directly on the JVM alongside regular Java code.This comprehensive tutorial will take you through the design and development of Groovy-based Domain Specific Languages. It is a complete guide to the development of several mini-DSLs with a lot of easy-to-understand examples. This book will help you to gain all of the skills needed to develop your own Groovy-based DSLs, as it guides you from the basics through to the more complex meta-programming features of Groovy. The focus is on how the Groovy language can be used to construct domain-specific mini-languages. Practical examples are used throughout to de-mystify the seemingly complex language features and to show how they can be used to create simple and elegant DSLs. The examples include a quick and simple Groovy DSL to interface with Twitter.The book concludes with a chapter focusing on integrating Groovy-based DSLs in such a way that the scripts can be readily incorporated into the readers' own Java applications. The overall goal of this book is to take Java developers through the skills and knowledge they need to start building effective Groovy-based DSLs to integrate into their own applications.

Table of Contents

Chapter 1: Introduction to DSL and Groovy
DSL: New name for an old idea
Groovy
Summary
Chapter 2: Groovy Quick Start
How to find and install Groovy
Running Groovy
Groovy IDE and editor integration
Introducing the Groovy Language
Summary
Chapter 3: 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
Closure scope
Summary
Chapter 4: Example DSL: GeeTwitter
Twitter
Working with the Twitter APIs
Groovy improvements
Removing boilerplate
Adding a command-line interface
Adding built-in methods
Summary
Chapter 5: Power Groovy DSL features
Named parameters
Builders
SwingBuilder
Method pointers
Metaprogramming and the Groovy MOP
How Builders work
ExpandoMetaClasses
Summary
Chapter 6: Existing Groovy DSLs
The Grails Object Relational Mapping (GORM)
Gant
ATDD, BDD with GSpec, EasyB, and Spock
Summary
Chapter 7: Building a Builder
Builder code structure
BuilderSupport
FactoryBuilderSupport
Summary
Chapter 8: Implementing a Rules DSL
Groovy bindings
Building a Rewards DSL
Summary
Chapter 9: Integrating it all
Mixing and matching Groovy and Java
GroovyClassLoader
Summary

What You Will Learn

Learn Groovy scripting designed to get Java programmers using Groovy quicklyUse the meta-programming features in Groovy to build your own DSLsLearn everything you need to know about Groovy markup and build your own Groovy builders to simplify your application developmentBuild effective DSLs using operator overloading and Groovy categoriesWork with Groovy closures Get to grips with the working of Groovy on the JVM and integrate Groovy with your Java applications

Authors

Table of Contents

Chapter 1: Introduction to DSL and Groovy
DSL: New name for an old idea
Groovy
Summary
Chapter 2: Groovy Quick Start
How to find and install Groovy
Running Groovy
Groovy IDE and editor integration
Introducing the Groovy Language
Summary
Chapter 3: 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
Closure scope
Summary
Chapter 4: Example DSL: GeeTwitter
Twitter
Working with the Twitter APIs
Groovy improvements
Removing boilerplate
Adding a command-line interface
Adding built-in methods
Summary
Chapter 5: Power Groovy DSL features
Named parameters
Builders
SwingBuilder
Method pointers
Metaprogramming and the Groovy MOP
How Builders work
ExpandoMetaClasses
Summary
Chapter 6: Existing Groovy DSLs
The Grails Object Relational Mapping (GORM)
Gant
ATDD, BDD with GSpec, EasyB, and Spock
Summary
Chapter 7: Building a Builder
Builder code structure
BuilderSupport
FactoryBuilderSupport
Summary
Chapter 8: Implementing a Rules DSL
Groovy bindings
Building a Rewards DSL
Summary
Chapter 9: Integrating it all
Mixing and matching Groovy and Java
GroovyClassLoader
Summary

Book Details

ISBN 139781847196903
Paperback312 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
Responsive Web Design with HTML5 and CSS3 Book Cover
Responsive Web Design with HTML5 and CSS3
$ 23.99
$ 4.80
Object-Oriented JavaScript - Second Edition Book Cover
Object-Oriented JavaScript - Second Edition
$ 29.99
$ 21.00
Learning jQuery, Third Edition Book Cover
Learning jQuery, Third Edition
$ 23.99
$ 16.80
Git: Version Control for Everyone Book Cover
Git: Version Control for Everyone
$ 23.99
$ 16.80
JavaScript and JSON Essentials Book Cover
JavaScript and JSON Essentials
$ 17.99
$ 12.60