Book Image

Groovy for Domain-Specific Languages, Second Edition

By : Fergal Dearle
Book Image

Groovy for Domain-Specific Languages, Second Edition

By: Fergal Dearle

Overview of this book

Table of Contents (20 chapters)
Groovy for Domain-specific Languages Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Introduction to DSLs and Groovy
Index

Summary


We covered a lot of ground in this chapter. We took a look at Groovy bindings to see how they can be used in our DSL scripts. By placing closures strategically in the binding, we can emulate named blocks of code. We can also provide built-in methods and other shorthand by including closures and named Boolean values in the binding. These techniques can be used to great effect to write DSL scripts that can be read and understood by stakeholders outside of the programming audience.

We've worked through a full implementation of a DSL for customer rewards by using these techniques, and we've seen how such a DSL can be integrated into an existing application. The reader should now have the confidence to start generating their own domain-specific DSLs that implement features in a similar way and integrate them into their own applications.

In the next and final chapter we will cover another fully worked DSL. The DSL we will implement in Chapter 12, Integrating It All, will make full use of...